Skip to content

Stream ciphers

Liesware edited this page Oct 1, 2019 · 2 revisions

eStream

eStream project

Stream ciphers video - 1

Stream ciphers video - 2

In order to understand hex and type parameters read HASH

Sosemanuk

spec

Description: Stream cipher and eStream winner.

Uses: Performance is very impportant.

Key size: from 128 to 256 bits, guaranteed security is only 128 bits.

Iv size: 128 bits

Salsa20

spec

Description: Stream cipher and eStream winner.

Uses: Performance is very impportant.

Key size: varibale

Iv size: 64 bits

How to ???

import requests
import json
import os,binascii

def sending(message):
	url = 'http://127.0.0.1:6613/'
	response = requests.post(url, data=message)
	print response.content
	return response.content

def stream(data_js):
	req=json.loads(data_js)
	print "Sosemanuk enc \n " + json.dumps(req) +"\n"
	data_js_n=sending(json.dumps(req))
	answ=json.loads(data_js_n)
	print "Recived enc: \n" + (json.dumps(answ)) +"\n\n\n"
	dec='{"algorithm":"SOSEMANUK","plaintext":"","iv":"b05691ef92cb9c9bf77e5613819fc4ea",\
	"version":1,"key":"7f685ba92789f0d8d421038f2b1b4fcd73be586d81795ec3ab7939975b7b896e","operation":"dec","type":"string"}'
	req=json.loads(dec)
	req["plaintext"]=answ["result"]
	print "Sosemanuk dec \n " + json.dumps(req) +"\n"
	data_js_n=sending(json.dumps(req))
	answ2=json.loads(data_js_n)
	print "Recived dec: \n" + (json.dumps(answ2)) +"\n\n\n"

data_js='{"algorithm":"SOSEMANUK","plaintext":"Hello world!","hex":0,"iv":"b05691ef92cb9c9bf77e5613819fc4ea",\
"version":1,"key":"7f685ba92789f0d8d421038f2b1b4fcd73be586d81795ec3ab7939975b7b896e","operation":"enc","type":"string"}'
stream(data_js)

In this example we encrypt and decrypt Hello world! string with the key and iv given

On data_js["algorithm"] can be SOSEMANUK or SALSA20

Json to enc string (key and iv depends on algorithm you chose)

{"algorithm":"estream flavor","plaintext":"your string","hex": BOOL,"iv":"Hex stringsize=16,32",
"version":1,"key":"Hex stringsize=32-64","operation":"enc","type":"string"}

Json to dec string (key and iv depends on algorithm you chose)

{"algorithm":"estream flavor","plaintext":"your hex enc string ","iv":"Hex stringsize=16,32",
"version":1,"key":"Hex stringsize=32-64","operation":"dec","type":"string"}

Json to enc file (key and iv depends on algorithm you chose)

{"algorithm":"estream flavor","file":"your file","iv":"Hex stringsize=16,32",
"version":1,"key":"Hex stringsize=32-64","operation":"enc","type":"file"}

Json to dec file (key and iv depends on algorithm you chose)

{"algorithm":"estream flavor","file":"your file","iv":"Hex stringsize=16,32",
"version":1,"key":"Hex stringsize=32-64","operation":"dec","type":"file"}
Clone this wiki locally