Skip to content

Commit c13dc59

Browse files
committed
Merge pull request Tygs#67 from Natim/set-default-key-size
Set the default key size to 256 bits.
2 parents 6387eb1 + ff0e9f1 commit c13dc59

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tools/zerobinpaste.coffee

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ program
55
.option('-u, --url [url]', 'URL of a 0bin site.')
66
.option('-e, --expire [period]',
77
'Expiration period - one of: 1_view, 1_day (default), 1_month, never.', '1_day')
8-
.option('-k, --entropy [bits]',
8+
.option('-k, --entropy [bytes]',
99
'Encryption key entropy (and hence length) to use,'\
10-
+ ' in bits, rounded up to multiple of 6 (default: 48).\n'\
11-
+ ' That key will be processed by 1000 pbkdf2-sha256 iterations, not used as-is.', 48)
10+
+ ' in bytes (default: 32).\n'\
11+
+ ' That key will be processed by 1000 pbkdf2-sha256 iterations, not used as-is.', 32)
1212
.option('-c, --config [path]',
1313
'Path to zerobin configuration file (default: ~/.zerobinpasterc).\n'\
1414
+ ' Should be json-file with the same keys as can be specified on the command line.\n'\
@@ -51,7 +51,7 @@ program.entropy = parseInt(program.entropy)
5151
# Generated key will use base64 (6b per char) charset
5252
# Key is not decoded for pbkdf2, so it's generated via base64 here just for convenience
5353
generate_key = (entropy) ->
54-
entropy = Math.ceil(entropy / 6) * 6 # non-6-multiple produces same-length base64
54+
entropy = Math.ceil(entropy / 8.0) * 8
5555
key = sjcl.bitArray.clamp(
5656
sjcl.random.randomWords(Math.ceil(entropy / 32), 0), entropy )
5757
return sjcl.codec.base64.fromBits(key, 0).replace(/\=+$/, '').replace(/\//, '-')

zerobin/static/js/behavior.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@
514514
try {
515515

516516
var expiration = $('#expiration').val();
517-
var key = zerobin.makeKey(48);
517+
var key = zerobin.makeKey(256);
518518

519519
zerobin.encrypt(key, paste,
520520

0 commit comments

Comments
 (0)