Last active
December 31, 2015 18:29
-
-
Save jcoglan/8027037 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>crypto</title> | |
</head> | |
<body> | |
<script src="./node_modules/vault-cipher/lib/crypto-js/aes.js"></script> | |
<script src="./node_modules/vault-cipher/lib/crypto-js/pbkdf2.js"></script> | |
<script src="./node_modules/vault-cipher/lib/crypto-js/hmac-sha256.js"></script> | |
<script src="./node_modules/vault-cipher/lib/buffer.js"></script> | |
<script src="./node_modules/vault-cipher/lib/crypto-shim.js"></script> | |
<script src="./node_modules/vault-cipher/lib/vault-cipher.js"></script> | |
<script> | |
var blob = 'X4dp/KfTVCVUMglQjBZXTc07HkJkxWqP2V1PZH0rJjM6pjzZQ0XDCDdOfAwx24CA3l+ErwGd/psaA6mFk9JAZ4DKbNMDpbfu6BQuwL8s6DSuWKrtq+25NSv3/q4TnmpcgSTEzpVwUDXBjwnModkBrnfry6jWbXurZsWt0EYQflko5bUnCDeopbCYgWRC/ZIlIbp8d+E/hSHEam61nbTl31QgGw7xz2s6d5R5X79xwV9ySH0uN4mdD2Dcxh2FMRvp98VB6qcZVzi1eddT91UseB5xP6++oz89WVdruQW51Eo=', | |
cipher = new Cipher('foo', {format: 'binary', input: 'binary', work: 100, salt: 'e87eb0f4-34cb-46b9-93ad-766c5ab063e7'}); | |
blob = new Buffer(blob, 'base64'); | |
var keyBlock = blob.slice(0,128); | |
cipher.decrypt(keyBlock, function(e, keyBlock) { | |
keyBlock = new Buffer(keyBlock, 'binary'); | |
var keys = [keyBlock.slice(0,32), keyBlock.slice(32,64)], | |
cipher = new Cipher(keys, {format: 'binary'}); | |
cipher.decrypt(blob.slice(128, blob.length), function(e, payload) { | |
console.log(payload); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment