1

This works

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);

This fails

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);

The difference is in the N parameter being 2^15 rather than 2^14

Any ideas?

Failure is as follows in the Firebug console

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
anthonyc
  • 187
  • 3
  • 13
  • This is the one - https://github.com/tonyg/js-scrypt – anthonyc Mar 26 '15 at 11:10
  • Yes, its the same code from TonyG – anthonyc Mar 26 '15 at 11:44
  • 1
    How does it fail? What is the error message? Please add this also to the GitHub issue. – Artjom B. Mar 26 '15 at 14:05
  • Issue link to GitHub: https://github.com/tonyg/js-scrypt/issues/16 – Artjom B. Mar 26 '15 at 14:07
  • Did you determine the exact point between 32768 and 65536 where the failure occurs? Is it always the same or different across runs / reboots? – Anton Samsonov Mar 26 '15 at 18:18
  • I understand that N has to be a power of 2, so 2^15 should be the next valid argument – anthonyc Mar 27 '15 at 11:16
  • @anthonyc In the current version of *scrypt.js* on GitHub (which may be the one you use, or not), the line `scrypt.js:132:9 [function ua(a)]` mentioned in your backtrace is all about producing a warning: **“Cannot enlarge memory arrays in asm.js. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value, or (2) set Module.TOTAL_MEMORY before the program runs”** whenever some computed value exceeds relevant threshold. Hope this gives you some insight. – Anton Samsonov Mar 27 '15 at 17:36

1 Answers1

2
 var scrypt = scrypt_module_factory(67108864);

fixes the problem. Thanks to Anton Samsonov above. It was a memory problem. Initialising with no parameter defaults to 32mb. Initialising as above sets the memory usage to 64mb.

anthonyc
  • 187
  • 3
  • 13