Snow Stream CipherSNOW 1.0/2.0/3G are synchronous stream ciphers developed by Thomas Johansson and Patrik Ekdahl (Lund University). SNOW 3G has been selected for the 3GPP encryption algorithms UEA2 and UIA2. It is used on 4G networks. |
Outline
The following shows the outline operation of Snow 3G. It uses a 128-bit key and a 128-bit IV. Snow 3G is a stream cipher and uses a LFSR with 16 cells of 8 bits each, along with a finite state machine (FSM).
Examples
- Key= 8ce33e2cc3c0b5fc1f3de8a6dc66b1f3, IV=d3c5d592327fb11cde551988ceb2f9b7. Output: 'eff8a3Bf751480f' Try!
- Key= 4035c6680af8c6d1a8ff8667b1714013, IV=62a540981ba6f9b74592b0e78690f71b. Output: 'a8c874a97ae7c4f8' Try!
Coding
The Python code is:
import sys import binascii from cryptomobile.CM import * count = 1923412495 bearer = 12 direct = 1 data = '~\xc6\x12rt;\xf1aG&Djl8\xce\xd1f\xf6\xcav\xebT0\x04B\x864l\xef\x13\x0f\x92\x92+\x03E\r:\x99u\xe5\xbd.\xa0\xebU\xad\x8e\x1b\x19\x9e>\xc41` \xe9\xa1\xb2\x85\xe7bySY\xb7\xbd\xfd9\xbe\xf4\xb2HE\x83\xd5\xaf\xe0\x82\xae\xe68\xbf_\xd5\xa6\x06\x199\x01\xa0\x8fJ\xb4\x1a\xab\x9b\x13H\x80' bitlen = 798 k = '2bd6459f82c5b300952c49104881ff48' i = 'ea024714ad5c4d84df1f9b251c0bf45f' if (len(sys.argv)>1): message=str(sys.argv[1]) if (len(sys.argv)>2): k=str(sys.argv[2]) if (len(sys.argv)>3): i=str(sys.argv[3]) key=binascii.a2b_hex(k) iv=binascii.a2b_hex(i) snow = SNOW3G() snow._initialize(key, iv) keystream=snow._generate_keystream(16) output=snow.F8(key, count, bearer, direct, data, bitlen) print "Data= \t",data.encode('hex') print "Key= \t",key.encode('hex') print "IV= \t",iv.encode('hex') print "-----------------------------" print "Key stream (16 bytes)=\t",keystream.encode('hex') print "--------F8-------------" print "Output stream=\t",output.encode('hex')