VUSB-Firmware for Attiny85 implementing HMAC one time password authentication
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
hmac-otp/test.c

22 lines
489 B

#include <stdio.h>
#include <assert.h>
#include "sha1.h"
char sha1sum[41];
int main(){
int i;
char* p;
sha1_init();
sha1_fill(0);
p=sha1sum;
for(i=0; i<20; ++i){
sprintf(p,"%02x", ((char*)(sha1_digest))[i] );
p+=2;
}
sprintf(sha1sum,"%x%x%x%x%x",sha1_digest[0],sha1_digest[1],sha1_digest[2],sha1_digest[3],sha1_digest[4]);
printf("SHA1: %s\n",sha1sum);
// assert(strncmp("da39a3ee5e6b4b0d3255bfef95601890afd80709",sha1sum)==0);
}