mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
Generate shorter 48-bit keys in the interface js
This commit is contained in:
parent
6675209e31
commit
d82669e8ee
@ -152,10 +152,13 @@
|
|||||||
}, 250); /* End of "decrypt" */
|
}, 250); /* End of "decrypt" */
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Create a random base64 string long enought to be suitable as
|
/** Create a random base64-like string long enought to be suitable as
|
||||||
an encryption key */
|
an encryption key */
|
||||||
makeKey: function () {
|
makeKey: function (entropy) {
|
||||||
return sjcl.codec.base64.fromBits(sjcl.random.randomWords(8, 0), 0);
|
entropy = Math.ceil(entropy / 6) * 6; /* non-6-multiple produces same-length base64 */
|
||||||
|
var key = sjcl.bitArray.clamp(
|
||||||
|
sjcl.random.randomWords(Math.ceil(entropy / 32), 0), entropy );
|
||||||
|
return sjcl.codec.base64.fromBits(key, 0).replace(/\=+$/, '').replace(/\//, '-');
|
||||||
},
|
},
|
||||||
|
|
||||||
getFormatedDate: function (date) {
|
getFormatedDate: function (date) {
|
||||||
@ -511,7 +514,7 @@
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
var expiration = $('#expiration').val();
|
var expiration = $('#expiration').val();
|
||||||
var key = zerobin.makeKey();
|
var key = zerobin.makeKey(48);
|
||||||
|
|
||||||
zerobin.encrypt(key, paste,
|
zerobin.encrypt(key, paste,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user