首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >scrypt.js失败,N大于2^14

scrypt.js失败,N大于2^14
EN

Stack Overflow用户
提问于 2015-03-26 08:15:43
回答 1查看 115关注 0票数 1

这是可行的

代码语言:javascript
复制
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);

此操作失败

代码语言:javascript
复制
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控制台中的故障如下所示

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2015-04-03 20:20:50

代码语言:javascript
复制
 var scrypt = scrypt_module_factory(67108864);

修复了问题。感谢上面的Anton Samsonov。这是一个记忆问题。不带参数的初始化默认设置为32mb。如上所述的初始化将存储器使用量设置为64mb。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29268935

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档