miracl / MIRACL

MIRACL Cryptographic SDK: Multiprecision Integer and Rational Arithmetic Cryptographic Library is a C software library that is widely regarded by developers as the gold standard open source SDK for elliptic curve cryptography (ECC).
https://miracl.com
654 stars 242 forks source link

SHA secret key problem #33

Closed baicaihenxiao closed 8 years ago

baicaihenxiao commented 8 years ago

I know how to use SHA256 to handle a string like this:

char s[HASH_LEN];
sha256 sh;

shs256_init(&sh);

for (i=0;;i++)
{
    if (string[i]==0) break;
    shs256_process(&sh,string[i]);
}
shs256_hash(&sh,s);

But I don't know how to set the SHA256' secret key, whether can I set it in the program? Thank you very much for any help

mcarrickscott commented 8 years ago

Hello,

Sha256 is a one way hash function. It does not have a secret key,

Mike

On Sunday 30 October 2016, baicaihenxiao notifications@github.com wrote:

I know how to use SHA256 to handle a string like this:

char s[HASH_LEN]; sha256 sh;

shs256_init(&sh);

for (i=0;;i++) { if (string[i]==0) break; shs256_process(&sh,string[i]); } shs256_hash(&sh,s);

But I don't know how to set the SHA256' secret key, whether can I set it in the program? Thank you very much for any help

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/miracl/MIRACL/issues/33, or mute the thread https://github.com/notifications/unsubscribe-auth/ACm8jji_HB8vGq-Dr1HQjOPo60EC6w-Hks5q5Ea1gaJpZM4KkT4y .

baicaihenxiao commented 8 years ago

Thank you, I think I have confused HMAC and SHA.