added length parameter to why2_sha256
This commit is contained in:
parent
f404da5e2d
commit
ea1bb6789e
@ -46,7 +46,7 @@ why2_bool why2_chat_ecc_verify_signature(char *message, char *signature, EVP_PKE
|
||||
char *why2_chat_ecc_serialize_public_key(); //GET PUBLIC ECC KEY IN BASE64
|
||||
EVP_PKEY* why2_chat_ecc_deserialize_public_key(char *pubkey); //GET EVP_PKEY FROM BASE64 PUBLIC ECC KEY
|
||||
|
||||
char *why2_sha256(char *input); //HASH input USING SHA256 AND RETURN IN STRING
|
||||
char *why2_sha256(char *input, size_t length); //HASH input USING SHA256 AND RETURN IN STRING
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -247,12 +247,12 @@ void why2_chat_deallocate_keys(void)
|
||||
EVP_PKEY_free(keypair);
|
||||
}
|
||||
|
||||
char *why2_sha256(char *input)
|
||||
char *why2_sha256(char *input, size_t length)
|
||||
{
|
||||
unsigned char *output = why2_malloc(SHA256_DIGEST_LENGTH + 1);
|
||||
char *formatted_output = why2_malloc(SHA256_DIGEST_LENGTH * 2 + 2);
|
||||
|
||||
SHA256((unsigned char*) input, strlen(input), output);
|
||||
SHA256((unsigned char*) input, length, output);
|
||||
|
||||
//SAVE AS STRING IN HEX
|
||||
for (int i = 0; i < SHA256_DIGEST_LENGTH; i++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user