C/C++ :: How To Do CRC Calculation For Base64 String

Aug 1, 2013

I am trying to calculate a CRC of a Base64 string. I know the answer of the checksum, but I don't how to calculate it (It is for Adobe project).

I give you the correct checksum : 2942042514

And now the string :
AQAAAAAAAABsYAAAAAAAAENvbXByZXNzZWRUaXRsZQB4nO0d2XIaSbI+hZ13
m0NCR0QNE7KOHcXKlkMwtnhyIIRkdjGwgGxpP35386jqursRsk0zQygkd+dR
lVmVmZVdl//3Xyl+E4/iixiJivgqBmIm5mIoJmIsfhW/iLp4LWrwbwUwY9EH
+C1gx+KesH+IjjgTr4Bqj2h+Ey0hxRHQTMQNcHwSV/A0EYsA3oFSFlDngDAf

[Code] ....

I tried CRC 16, 32 and with polynomial 0xEDB88320L, and with all these tries, I cannot find the correct checksum, it is my main problem.

View 12 Replies


ADVERTISEMENT

C++ :: How To Do CRC Calculation For Base64 String

Aug 1, 2013

I am trying to calculate a CRC of a Base64 string.I give you the correct checksum : 2942042514...And now the string :

AQAAAAAAAABsYAAAAAAAAENvbXByZXNzZWRUaXRsZQB4nO0d2XIaSbI+hZ13
m0NCR0QNE7KOHcXKlkMwtnhyIIRkdjGwgGxpP35386jqursRsk0zQygkd+dR
lVmVmZVdl//3Xyl+E4/iixiJivgqBmIm5mIoJmIsfhW/iLp4LWrwbwUwY9EH
[code]....

I tried CRC 16, 32 and with polynomial 0xEDB88320L, and with all these tries, I cannot find the correct checksum, it is my main problem.I don't want C++ code source, but I am searching for the method or algorithm to find it. If you want to know, this string in base64 contains an string compressed in zip, which contains an UTF16 XML. I want to modify information, and modify Adobe Projet (prproj)

View 6 Replies View Related

C++ :: Stream Buffer To Base64 String

Oct 2, 2013

I have problem with this code:

#include <windows.h>
#include <stdio.h>
#include <gdiplus.h>
#include "ScreenCap.h"
#include <wchar.h>
#include "base64.h"
#include <sstream>

using namespace Gdiplus;
int GetEncoderClsid(WCHAR *format, CLSID *pClsid) {

[Code] ....

This function return me a long series of Y ended with other chars but not the base64 string.

I think the problem is std::string encodedstring = base64_encode(buffer, dwBufferSize); but I can't figure out the problem.

The base64 function is: [URL] ....

View 2 Replies View Related

C++ :: Convert A String Into Mathematical Calculation And Calculate In Correct Order

May 6, 2013

I want to program an advanced calculator. I'd like to enter some more complex expressions like -17+3*4*(4-sqrt(4) and i want, that mathematical operations are done the correct order, so at first 4-sqrt(4) is calculated, then 3*4*2 and then -17 is subtracted.

Problem 1: Convert a string into a mathematical calculation
Problem 2: Calculate in the correct order

How would I do that (I dont expect perfecly precoded calculators from you, just the way how to do it)

Google search just delivers primitive calculations with entry methods like

Enter first number 1
Enter operator +
Enter second number 2

3

But thats not what i want

View 2 Replies View Related

C/C++ :: Convert Sha256 To Base64?

Mar 28, 2015

I have seen a code in one site which could convert sha256 hash to base64 with C language but when I tested it, it didn't work at that time so I ignored. I need it now but unfortunately I can't find it through the net anymore. I want to ask if there is such code in C or other languages that can convert sha256 hash to base64?

View 1 Replies View Related

C++ :: Convert File (Audio / Image / Video) To Base64?

Sep 7, 2014

I'm looking to convert audio, images, video to base64 in c++, and through many searches on the web I've only seem to come up with string > base64.

When I view a .mp3 file for example, there are many characters there that are not available to be used in my string to encode.

[URL] ....

I have this code set up in my project, and all I want is to be able to give the location of any file and have it encode (could just encode to a string, I can handle writing it to a file), and then give a location to put the decoded file as well.

I'm not sure exactly where to even start.

View 6 Replies View Related

C++ :: CRC 32 Calculation Of File

Jan 3, 2014

i need to calculate crc32 of a input file and check with the original crc value of a file and return true/false,

View 4 Replies View Related

C++ :: Simple Calculation Going To 0 Every Time

Aug 8, 2013

I tried to write a simple program to calculate monthly yield, APR, and principle in various directions. Anyway, here's some code to get the APR from the principle and monthly yield. When I run it though, it spits 0 at me every time! What the problem is; the other functions work just fine and the code line for the APR calculation is just what it ought to be - I see neither a math nor tech problem here.

Here is the offending function:

Code:
void calculateAPR() {
int principle, monthlyYield, apr;
cout<<"
Please input the principle:";
cin>>principle;
cin.ignore();

[code]....

View 4 Replies View Related

C :: Calculation Of A Bitwise Expression

Mar 6, 2015

I would like to ask about how we calculates the following bitwise expression.

Code:

unsigned char ch[2] = {0x49,0x49};
ch[0] | ch[1] << 8; I'm thinking ch[1] << 8 as 0x00 ...

So, I think that the above expression converts to 0x49 | 0x00 ... and the complete expression should be 0x49 for me.

But, the compiler gives me the result of 0x4949 as two bytes.How does the compiler calculate this expression as two bytes?show me the steps included in the calculation of this expression?

View 2 Replies View Related

C :: 2 User Inputs For Calculation

Apr 9, 2014

I want to have calculations take place inside a switch statement that calls the appropriate function. The menu portion of the program works well, but I can't figure out how to let the user actually input 2 different numbers to the functions. My questions are:

1. If I use scanf to assign values to the variables, what determines end of input to each variable? (ie.. scanf("%d%d", &a, &b) what is the end of a, what is the end of b?)

2. Should I assign the variables to user input inside the switch, or try to do it in the functions below?

3. Is there something I haven't thought to ask that will screw me over? I'm really new to this.

Code:
#include<stdio.h>
int add(int b, int a);
int mult(int b, int a);
main() {

[Code] ....

This really was a test of multilayer menu, but I want to add functionality if I can.

Changed a variable before posting and didn't change all the conditions testing it.

View 3 Replies View Related

C++ :: Simple Calculation Of Char?

Dec 17, 2013

void viewWasteReport(){
EXEC SQL BEGIN DECLARE SECTION;
char wasteid[5],wastetype[31],month[11],wastequantity[13],wasteweight[11];
//double wastequantity[13];
//double wasteweight[11];
EXEC SQL END DECLARE SECTION;
fnConnectDB();

[Code] ....

I want to obtain the the product of wastequantity*wasteweight, but i get error.

View 6 Replies View Related

C++ :: Inflation Calculation For Two Years?

Oct 1, 2014

#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>

[Code]....

Write a program that outputs inflation rates for two successive years and whether the inflation is increasing or decreasing. Ask the user to input the current price of an item and its price one year and two years ago.

To calculate the inflation rate for a year, Uh, no, that’s wrong! To calculate the inflation rate for a year, subtract the price of the item ONE YEAR AGO from the price of the item for that year and then divide the result by the price a year ago. For example: 2014-Inflation-Rate = (2014-Price minus 2013-Price) / 2013-Price.

Your program must contain at least the following functions:

•a function to get the input
•a function to calculate the results
•a function to output the results

View 1 Replies View Related

C/C++ :: Do While Loop And Average Calculation

Dec 9, 2014

I need to create average calculating program using do while loop.

t = 1 - sin(x) when x > 0;
t = 1 + x when x = 0;
t = a + sin(x) when x < 0;
primary information:
x changes from 1 to -1 by step h = -0.5, a = -2

#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main() {
int a = -2;

[Code] ....

How this program should look that's why this probably looks just like a mess.

View 2 Replies View Related

C++ :: Possibility Of Compile Time Calculation

May 13, 2013

Is there any possible way of calculating some values at compile time? I have the following code of genereting upto 2000000010 palindrome numbers.

Code:
#include <iostream>
#include <string>
#include <sstream>
#include <string.h>
#include <stdlib.h>

[Code] .....

As you see, I have taken input from the user just after calculating the whole palindromes. So cant we calculate this at compile time? because runtime of this program is extremely slow.

Another qs. I first tried to use array but It didnt allow 2*10^9 sized array. so what should I do whenever I need that size of array?

View 12 Replies View Related

C :: Simple Calculation - Function To Do Factorization

Feb 8, 2014

I wrote a function to do factorization (n!). while this function works perfectly:

Code:
int fact (double x){
register int z=1;
if (x==0)
return 1;
else
for(x;x;x--)
z*=x;
return z;
}

this doesn't:

Code:
int fact (double x){
if (x==0)
return 1;
else
for(x;x;x--)
x*=x;
return x;
}

what makes the second one different from the first one? can't see the difference..

View 1 Replies View Related

C :: Output Calculation (random Numbers)

Mar 24, 2014

Why do i keep getting wrong results

Code:
#include "stdafx.h"#include <stdio.h>
#include <string.h>
nt main(void){
char name[40];
int numbers[50];

[Code] .....

View 4 Replies View Related

C++ :: Calculator Program - How To Do Sine Calculation

Apr 26, 2013

I am basically trying to make a program for a calculator. I am struggling with how to do the sine calculation. this calculation will take place at line 158.

#include <iostream>
#include <cmath>
using namespace std;
int main() {

double firstNumber = 0.0;
double secondNumber = 0.0;
char operation =' ';

[Code] ....

View 1 Replies View Related

C++ :: Payroll Program - Calculation Error?

May 22, 2014

I'm working on a payroll program and I'm having problems that are causing calculation errors.

My input file is
1234FredJones4025.00
2345 TerrySmith6010.00

The errors I get are from the regular pay, over time pay, gross pay, tax amount and net pay calculations. They all look similar to this (6e+002). I believe they are occurring because regular pay isn't calculating correctly and the rest depend on that for their calculations. However, I can't see why regular pay isn't calculating correctly.

#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;
class payroll{
ifstream fin;
char employeeid[100];

[Code] .....

View 14 Replies View Related

C++ :: Getting Strange Print Out For Calculation Of Volume

Apr 4, 2013

// DEBUG3-4
// This program contains a class for a cylinder
// Data members are radius and height
// The volume is calculated as pi times radius squared times height
// If no height is given, it's not a cylinder - it's a circle!

#include<iostream>
using namespace std;
//declaration section

[Code].....

View 1 Replies View Related

C/C++ :: Pointer Values Into Pythagoras Calculation

Mar 31, 2014

I have a doubly linked list, which reads in a set of coordinates x and y.

I need to pass these coordinates into a method called calculateImportance and execute Pythagoras on them. With this in mind I need to be able to access the pointers current, next and prev.

The issue I am having, is that I am unable to pass the pointers through to the method?

This is the list.h

#include <iostream>
class List {
private:
typedef struct node {
int xCoord;
int yCoord;
float importanceFactor;

[Code] .....

View 6 Replies View Related

C++ :: Taking Input File And Doing Calculation

Dec 13, 2014

I am trying to work on a C++ program to calculate the quadratic formula using input files and classes. I have written my class, but I am trying to find a way to take an input file with unknown number of lines of coefficients. How do I take each integer from each line and set that value as "a" and "b" and so forth, then start over on the next line?

This is what i have so far.

fstream inputfile;//users input quadratic coefficients file
ofstream outputfile;// outputs a file with solutions
int main(int argc, char *argv[])// argc is argument count, char *argv[] is array of array of characters for arguments {
string dataline;
getline(inputfile, dataline);

[code].....

View 1 Replies View Related

C :: Calculation Birth Date As Floating Number

Sep 25, 2014

i want to calculate age of a person so then i try to make an algorithm which is used in a function like (i know to use math.h for abs()) double age_calculator( int year, int month, int day);

Code:

double age_calculator( int year, int month, int day);
// p means present(current)
int pyear=(2014-year)*365;
int pmonth=(abs(9-month))*30;
int pday=abs(25-day);
return (pyear+pmonth+pday)/365.0;

how can i use current date, i mean i want to use date of present day instead of 2014,25 and 9. I don't know how i can use date of every day.For instance my function returns 14.74 for the parameters; 2000, 01, 01 (for the current day 25/09/2014)

View 6 Replies View Related

C++ :: Operator Definitions - Modulus Remainder Calculation

Oct 18, 2014

where are operators defined in C/C++? in headers or compiled code?

looking for the definition of how % modulus is calulated

View 19 Replies View Related

C++ :: State The Values Of Each Int Variables After Calculation Is Performed

May 2, 2013

Question: State the values of each of these int variables after the calculation is performed. Assumed that, when each statement begins executing, all variables have the integer value 5.

a) product *= x++;

b) quotient /= ++x;

What is the answer for a and b?

View 4 Replies View Related

C++ :: Average Calculation Function Not Working As Expected To

Dec 16, 2013

[URL] ....

My calculation function will not work like i wanted it to. It gives me 0 or a crazy number.

this is the function here:
the entire code is on the link:

double calculations(data&avgs) //Calculates the students grade into a final grade
{
int avg1;
int avg2;
int avg3;
int lab1;

[Code] ....

View 12 Replies View Related

C++ :: Working With Strings / Files And Time-tag Calculation

Dec 27, 2012

I'm trying to calculate a series of times from start to end, and find out the duration between them, sum them up and see if they're above a certain value or not, for each particular instance.

My goal is to provide a prepared text file with time tags such as this:

Mon 19-Nov-2012 09:12 Mon 19-Nov-2012 09:34
Wed 21-Nov-2012 13:14Wed 21-Nov-2012 17:11
Fri 07-Dec-2012 15:21Fri 07-Dec-2012 15:26
=============================================
Mon 26-Nov-2012 12:50Tue 27-Nov-2012 15:29
Wed 12-Dec-2012 13:07Wed 12-Dec-2012 14:58
Fri 14-Dec-2012 14:22Fri 14-Dec-2012 14:29

And the program is able to calculate the total time relevant to each instance (instances separated by a line of '=').

Some form of number should somehow identify each instance or something similar and a text file is generated with total time printed for each instance. E.g.

Instance 1: 00h22m + 03h57m + 00h05m = 04h24m
Instance 2: 04h15m + 07h44m + 01h51m + 00h07m = 14h04m

Now I'm currently working on making the logic to calculate time within the ranges I'd like based on several parameters.

Are there any references I can use when it comes to working with strings in order to seek and extract these values in order to work with them? The documentation available on this website, despite being very informative, does not show practical applications of said class and I'm at a loss on how to implement the functionality.

View 17 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved