-
-
Save pharaoh1/9a432c28ca4970c7547208befcf2150d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A7~A9, use SHA1 algorithm to generate apnonce. | |
unsigned long buf = 0x1111111111111111; | |
unsigned char result[CC_SHA1_DIGEST_LENGTH]; | |
CC_SHA1(&buf, sizeof(buf), result); | |
for (int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) | |
printf("%02" PRIx32, result[i]); | |
putchar('\n'); | |
//A10~A11, use SHA384 algorithm, but only take the first 32 bits to generate apnonce. | |
unsigned long buf = 0x1111111111111111; | |
unsigned char result[CC_SHA384_DIGEST_LENGTH]; | |
CC_SHA384(&buf, sizeof(buf), result); | |
for (int i = 0; i < MIN(CC_SHA384_DIGEST_LENGTH, 32); i++) | |
printf("%02" PRIx32, result[i]); | |
putchar('\n'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment