# SIMECK-T: An Ultra-Lightweight Encryption Scheme for Resource-Constrained Devices
## 2 Methodology
### Implementation
```
Input: master_key[4], plaintext[2] Output: ciphertext[2]
1 Initialize:
2 simeckrounds \(\gets\) 3
3 tearounts \(\leftarrow\) 5
4 static cnt \(\leftarrow\) IV
5 plain[2] \(\leftarrow\) split_uint64_to_uint32(cnt);// block counter mode encrypts cnt
6 keys[4] \(\leftarrow\) {master_key[0], master_key[1], master_key[2], master_key[3]}
7 ciphertext[0] \(\leftarrow\) plain[0]
8 ciphertext[1] \(\leftarrow\) plain[1]
9 constant \(\leftarrow\) 0 xFFFFFC
10 sequence \(\leftarrow\) 0x938 BCA3083F
11 simeckrounds \(\leftarrow\) simeckrounds + psum;// depends on password
12 tearounts \(\leftarrow\) tearounts + pmul ;// depends on password
13 foridx \(\leftarrow\) 0 to simeckrounds - 1 do
14 ROUND64(keys[0], ciphertext[1], ciphertext[0], temp);
15 constant \(\leftarrow\) constant \(\wedge\)0 xFFFFFC;
16 constant \(\leftarrow\) constant \(\vee\) (sequence \(\wedge\) 1);
17 sequence \(\leftarrow\) sequence > 1;
18 ROUND64(constant, keys[1], keys[0], temp);
19 Rotate keys left;// keys[1] \(\rightarrow\) keys[2], keys[2] \(\rightarrow\) keys[3], keys[3] \(\rightarrow\) keys[1]
20 y \(\leftarrow\) ciphertext[0];
21 z \(\leftarrow\) ciphertext[1];
22 sum \(\leftarrow\) 0;
23 delta \(\leftarrow\) 0x953779b9;// a key schedule constant
24 fortearounts \(\leftarrow\) tearounts - 1 to 0 do
25 sum \(\leftarrow\) sum + delta;
26 y \(\leftarrow\) y + ((z < 4) + keys[0]) \(\oplus\) (z + sum) \(\oplus\) ((z > 5) + keys[1]);
2 z \(\leftarrow\) z + ((y < 4) + keys[2]) \(\oplus\) (y + sum) \(\oplus\) ((y > 5) + keys[3]);
27 ciphertext[0] \(\leftarrow\) y;
28 ciphertext[1] \(\leftarrow\) z;
29 ciphertext[0] \(\leftarrow\) ciphertext[0] \(\oplus\) plaintext[0];// block counter mode
30 ciphertext[1] \(\leftarrow\) ciphertext[1] \(\oplus\) plaintext[1];// block counter mode
31 cnt \(\leftarrow\) cnt + 1;// block counter mode
```  
**Algorithm 1**The proposed SIMECK-T algorithm [34]  
The TEA [30], XTEA [53], XXTEA [67], SPECK [7], SIMON [7], and SIMECK [29] ciphers are used to encrypt a 1 GB file that contains only bits of zero. The selection of these two families of ciphers, TEA and SPECK, where SIMECK is also accounted for to be part of the SPECK family by incorporating SIMON, is not arbitrary. The tinyness of TEA is unequivocally unique in the history of cryptography. This family of ciphers has received widespread public scrutiny and adoption in many industries. TEA emerged as the fastest cipher in literature surveys [35]. A more recent survey presents SPECK as the fastest cipher [40]. The public scrutiny and adoption of SPECK as a lightweight cryptography solution is also taken into account. The US National Security Agency's family of ciphers was not only a milestone in modern cryptography, the reputed agency's algorithms, SPECK and SIMON, were also a heads-up call for derivative work to appear, reviving the design and use of ARX ciphers. Derived by enhancing these ciphers using the dynamic substitution layer of SPECK-R [19] with RC4D [22], the ciphers called SIMON-R, SIMECK-R, TEA-R, XTEA-R, and XXTEA-R are obtained. These are also used to encrypt the 1 GB file containing bits set to zero. NIST recommends a password-based key derivation function (PBKDF). Memory hard techniques such as balloon hashing [68] and Argon2 [69] are incompatible with devices with limited resources. Algorithm 2 uses PBKDF2 [70] with 65000 iterations to produce a derived key based on the given password. The counter-mode initialization vector (IV) is computed in a way that prevents the same pair (IV, password) to be used twice. The file modification time string of the input file is converted into a Fowler-No-Vo (FNV) hash [61], and this is used as a seed for a pseudorandom number generator [60]. Since \(psum\) and \(pmul\) are checksums based on the derived key, these two variables are used, along with the FNV hash of the filename (without the extension), to obtain a unique IV on lines 12-13.