Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

w & s initialized as new int arrays and deleted accordingly #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/SHA256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ uint32** SHA256::preprocess(const unsigned char* input, size_t &nBuffer){
* @param h array of output message digest
*/
void SHA256::process(uint32** buffer, size_t nBuffer, uint32* h){
uint32 s[WORKING_VAR_LEN];
uint32 w[MESSAGE_SCHEDULE_LEN];
uint32 *s = new uint32[WORKING_VAR_LEN];
uint32 *w = new uint32[MESSAGE_SCHEDULE_LEN];

memcpy(h, hPrime, WORKING_VAR_LEN*sizeof(uint32));

Expand Down Expand Up @@ -129,7 +129,8 @@ void SHA256::process(uint32** buffer, size_t nBuffer, uint32* h){
h[j] += s[j];
}
}

delete[] s;
delete[] w;
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/SHA384.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ uint64** SHA384::preprocess(const unsigned char* input, size_t &nBuffer){
* @param h array of output message digest
*/
void SHA384::process(uint64** buffer, size_t nBuffer, uint64* h){
uint64 s[WORKING_VAR_LEN];
uint64 w[MESSAGE_SCHEDULE_LEN];
uint64 *s = new uint64[WORKING_VAR_LEN];
uint64 *w = new uint64[MESSAGE_SCHEDULE_LEN];

memcpy(h, hPrime, WORKING_VAR_LEN*sizeof(uint64));

Expand Down Expand Up @@ -128,7 +128,8 @@ void SHA384::process(uint64** buffer, size_t nBuffer, uint64* h){
h[j] += s[j];
}
}

delete[] s;
delete[] w;
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/SHA512.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ uint64** SHA512::preprocess(const unsigned char* input, size_t &nBuffer){
* @param h array of output message digest
*/
void SHA512::process(uint64** buffer, size_t nBuffer, uint64* h){
uint64 s[WORKING_VAR_LEN];
uint64 w[MESSAGE_SCHEDULE_LEN];
uint64 *s = new uint64[WORKING_VAR_LEN];
uint64 *w = new uint64[MESSAGE_SCHEDULE_LEN];

memcpy(h, hPrime, WORKING_VAR_LEN*sizeof(uint64));

Expand Down Expand Up @@ -128,7 +128,8 @@ void SHA512::process(uint64** buffer, size_t nBuffer, uint64* h){
h[j] += s[j];
}
}

delete[] s;
delete[] w;
}

/**
Expand Down