In response to this question:
This works correctly for me on Ubuntu, and produces the same output each time I run it.
Compile with:
gcc c.c -lssl -lcrypto -o c
Run with:
./c
Output:
c9 16 e7 1d 73 3d 06 cb 77 a4 77 5d e5 f7 7f d0 b4 80 a7 e8
In response to this question:
This works correctly for me on Ubuntu, and produces the same output each time I run it.
Compile with:
gcc c.c -lssl -lcrypto -o c
Run with:
./c
Output:
c9 16 e7 1d 73 3d 06 cb 77 a4 77 5d e5 f7 7f d0 b4 80 a7 e8
| #include <stdio.h> | |
| #include <string.h> | |
| #include <openssl/sha.h> | |
| int main(void) | |
| { | |
| int i; | |
| unsigned char buffer[] = "Whatever"; //input, which is always the same one | |
| unsigned char obuf[20]; | |
| SHA1(buffer, strlen(buffer), obuf); | |
| for (i = 0; i < 20; i++) { | |
| printf("%02x ", obuf[i]); | |
| } | |
| printf("\n"); | |
| return 0; | |
| } |