【问题标题】:scrypt.js fails with N greater than 2^14scrypt.js 失败,N 大于 2^14
【发布时间】:2015-05-29 21:46:16
【问题描述】:

这行得通

var scrypt = scrypt_module_factory();
var pwh=scrypt.crypto_scrypt(scrypt.encode_utf8("pleaseletmein"),
            scrypt.encode_utf8("SodiumChloride"),
            Math.pow(2,14), 8, 1, 224);

这失败了

var scrypt = scrypt_module_factory();
var pwh=scrypt.crypto_scrypt(scrypt.encode_utf8("pleaseletmein"),
            scrypt.encode_utf8("SodiumChloride"),
            Math.pow(2,15), 8, 1, 224);

区别在于N参数是2^15而不是2^14

有什么想法吗?

在Firebug控制台中失败如下

uncaught exception: abort() at 
wa@http://localhost/keybase/javascript/scrypt.js:10126:9      
ua@http://localhost/keybase/javascript/scrypt.js:132:9 
nc@http://localhost/keybase/javascript/scrypt.js:1266:9 
bL@http://localhost/keybase/javascript/scrypt.js:4164:33    
bu@http://localhost/keybase/javascript/scrypt.js:2168:33  
crypto_scrypt@http://localhost/keybase/javascript/scrypt.js:10263:1  
get_salt/<.success@http://localhost/keybase/javascript/main.js:91:1  
jQuery.Callbacks/fire@http://code.jquery.com/jquery-latest.js:3119:1  
jQuery.Callbacks/self.fireWith@http://code.jquery.com/jquery- 
latest.js:3231:7 
done@http://code.jquery.com/jquery-latest.js:9275:67 
.send/callback@http://code.jquery.com/jquery-latest.js:9685:8   
.send@http://code.jquery.com/jquery-latest.js:9691:7   
.ajax@http://code.jquery.com/jquery-latest.js:9176:5  
get_salt@http://localhost/keybase/javascript/main.js:95:9  
@http://localhost/keybase/javascript/main.js:58:9  
jQuery.event.dispatch@http://code.jquery.com/jquery-latest.js:4641:1  
jQuery.event.add/elemData.handle@http://code.jquery.com/jquery-
latest.js:4309:1

【问题讨论】:

  • 是的,它与 TonyG 的代码相同
  • 它是如何失败的?错误信息是什么?请将此也添加到 GitHub 问题中。
  • 发布到 GitHub 的链接:github.com/tonyg/js-scrypt/issues/16
  • 您是否确定了 32768 和 65536 之间发生故障的确切点?运行/重启时总是相同还是不同?

标签: javascript hash cryptography scrypt


【解决方案1】:
 var scrypt = scrypt_module_factory(67108864);

解决了这个问题。感谢上面的安东萨姆索诺夫。这是一个内存问题。无参数初始化默认为 32mb。如上所述初始化将内存使用设置为 64mb。

【讨论】:

    猜你喜欢
    • 2021-10-29
    • 1970-01-01
    • 2014-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-27
    相关资源
    最近更新 更多