Coherence
Search…
Stream-ciphers

eStream

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 ???

1
import requests
2
import json
3
import os,binascii
4
5
def sending(message):
6
url = 'http://127.0.0.1:6613/'
7
response = requests.post(url, data=message)
8
print response.content
9
return response.content
10
11
def stream(data_js):
12
req=json.loads(data_js)
13
print "Sosemanuk enc \n " + json.dumps(req) +"\n"
14
data_js_n=sending(json.dumps(req))
15
answ=json.loads(data_js_n)
16
print "Recived enc: \n" + (json.dumps(answ)) +"\n\n\n"
17
dec='{"algorithm":"SOSEMANUK","plaintext":"","iv":"b05691ef92cb9c9bf77e5613819fc4ea",\
18
"version":1,"key":"7f685ba92789f0d8d421038f2b1b4fcd73be586d81795ec3ab7939975b7b896e","operation":"dec","type":"string"}'
19
req=json.loads(dec)
20
req["plaintext"]=answ["result"]
21
print "Sosemanuk dec \n " + json.dumps(req) +"\n"
22
data_js_n=sending(json.dumps(req))
23
answ2=json.loads(data_js_n)
24
print "Recived dec: \n" + (json.dumps(answ2)) +"\n\n\n"
25
26
data_js='{"algorithm":"SOSEMANUK","plaintext":"Hello world!","hex":0,"iv":"b05691ef92cb9c9bf77e5613819fc4ea",\
27
"version":1,"key":"7f685ba92789f0d8d421038f2b1b4fcd73be586d81795ec3ab7939975b7b896e","operation":"enc","type":"string"}'
28
stream(data_js)
Copied!
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)
1
{"algorithm":"estream flavor","plaintext":"your string","hex": BOOL,"iv":"Hex stringsize=16,32",
2
"version":1,"key":"Hex stringsize=32-64","operation":"enc","type":"string"}
Copied!
Json to dec string (key and iv depends on algorithm you chose)
1
{"algorithm":"estream flavor","plaintext":"your hex enc string ","iv":"Hex stringsize=16,32",
2
"version":1,"key":"Hex stringsize=32-64","operation":"dec","type":"string"}
Copied!
Json to enc file (key and iv depends on algorithm you chose)
1
{"algorithm":"estream flavor","file":"your file","iv":"Hex stringsize=16,32",
2
"version":1,"key":"Hex stringsize=32-64","operation":"enc","type":"file"}
Copied!
Json to dec file (key and iv depends on algorithm you chose)
1
{"algorithm":"estream flavor","file":"your file","iv":"Hex stringsize=16,32",
2
"version":1,"key":"Hex stringsize=32-64","operation":"dec","type":"file"}
Copied!
Last modified 9mo ago