5 * \brief SHABEA - a SHA Based Encrytion Algorithm implementation
9 * SHABEAn-r where n is the blocksize and r the number of round used
23 void memxor(uint8_t * dest, uint8_t * src, uint8_t length){
32 #define L ((uint8_t*)block+0)
33 #define R ((uint8_t*)block+8)
34 void shabea128(void * block, void * key, uint16_t keysize, uint8_t enc, uint8_t rounds){
37 uint16_t kbs; /* bytes used for the key / temporary block */
40 r = (enc?0:(rounds-1));
41 kbs = keysize/8 + ((keysize&7)?1:0);
43 memcpy(tb+8+2, key, kbs);
46 for(;r!=(enc?(rounds):-1);enc?r++:r--){ /* enc: 0..(rounds-1) ; !enc: (rounds-1)..0 */
47 memcpy(tb, R, 8); /* copy right half into tb */
49 sha256(&hash, tb, 64+16+keysize);
50 if(!(r==(enc?(rounds-1):0))){