aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ocb.js
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2012-02-18 19:07:39 -0500
committerGuillaume Horel <guillaume.horel@gmail.com>2012-02-18 19:07:39 -0500
commit015e2d2492519c96dda7a310d888b29984e9fead (patch)
treeb199b61932450a047a7f10ddac30b32086ee131b /crypto/ocb.js
parent96dd59f2a302495387999c09ced5e70e85dd82f3 (diff)
downloadalias-015e2d2492519c96dda7a310d888b29984e9fead.tar.gz
Implementation of aes-ocb in python and javascript
We can know easily encrypt directories in python, and generate objects in the alias format.
Diffstat (limited to 'crypto/ocb.js')
-rw-r--r--crypto/ocb.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/ocb.js b/crypto/ocb.js
new file mode 100644
index 0000000..d7d53aa
--- /dev/null
+++ b/crypto/ocb.js
@@ -0,0 +1,8 @@
+load('sjcl.js')
+var aeskey = sjcl.codec.hex.toBits('12538243c49f1c58e6f7b0687bbd65b2')
+var iv = sjcl.codec.hex.toBits('250c3041c00a605a4100e264abbc588b')
+plaintext = "La chaire est triste, hélas ! et j'ai lu tous les livres."
+var secret = sjcl.encrypt(aeskey, plaintext,{mode:'ocb2', iv:iv, adata:"", tag:128})
+var secret2 = sjcl.json.decode(secret)
+print(secret)
+print(sjcl.codec.hex.fromBits(secret2.ct))