1234567891011121314151617181920212223242526 |
- #ifndef SPECK_HEADER
- #define SPECK_HEADER
- // The same stuff for 16 bit
- #define ROTL16(x,r) (((x)<<(r)) | (x>>(16-(r))))
- #define ROTR16(x,r) (((x)>>(r)) | ((x)<<(16-(r))))
- #define ER16(x,y,k) (x=ROTR16(x,7), x+=y, x^=k, y=ROTL16(y,2), y^=x)
- #define DR16(x,y,k) (y^=x, y=ROTR16(y,2), x^=k, x-=y, x=ROTL16(x,7))
- #define u8 uint8_t
- #define u16 uint16_t
- #define u32 uint32_t
- #define u64 uint64_t
- void EncryptBlock(u8 pt[], u8 k[], u8 ct[]);
- void Speck3264_EncryptBlock(u8 pt[], u8 k[], u8 ct[]);
- void Words16ToBytes(u16 words[],u8 bytes[],int numwords);
- void BytesToWords16(u8 bytes[],u16 words[],int numbytes);
- void Speck3264KeySchedule(u16 K[],u16 rk[]);
- void Speck3264Encrypt(u16 Pt[],u16 Ct[],u16 rk[]);
- void Speck3264Decrypt(u16 Pt[],u16 Ct[],u16 rk[]);
- #endif
|