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/trunc.h

18 lines
719 B

#ifndef _TRUNC_H_
#define _TRUNC_H_
#include "hmac.h"
#define TO_LITTLE_ENDIAN64(x) (x & 0xFF00000000000000ul)>>(7*8) |\
(x & 0x00FF000000000000ul)>>(5*8) |\
(x & 0x0000FF0000000000ul)>>(3*8) |\
(x & 0x000000FF00000000ul)>>(1*8) |\
(x & 0x00000000FF000000ul)<<(1*8) |\
(x & 0x0000000000FF0000ul)<<(3*8) |\
(x & 0x000000000000FF00ul)<<(5*8) |\
(x & 0x00000000000000FFul)<<(7*8)
int32_t get_otp(uint8_t* hmac, uint8_t digits);
int32_t get_otp_from_cnt(uint64_t cnt, uint8_t digits);
#endif