Skip to content

Instantly share code, notes, and snippets.

@khanzf
Last active October 3, 2018 04:15
Show Gist options
  • Save khanzf/956f84b7309c181aff0d03e7f359b4a1 to your computer and use it in GitHub Desktop.
Save khanzf/956f84b7309c181aff0d03e7f359b4a1 to your computer and use it in GitHub Desktop.
SHA1 on BSD
// Compiled on BSD with cc shatest.c -o shatest -lmd
#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <sha.h>
#define HEX_DIGEST_LENGTH 257
int
main() {
SHA1_CTX context;
char buf[HEX_DIGEST_LENGTH];
unsigned char buffer[] = "bismillah";
SHA1_Init(&context);
SHA1_Update(&context, buffer, strlen(buffer));
printf("%s\n", SHA1_End(&context, buf));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment