Skip to content

Commit e603143

Browse files
committed
scrypt: update to new function name
1 parent 021792c commit e603143

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/bitcoin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def litecoin_hash(hex)
325325
bytes = [hex].pack("H*").reverse
326326
begin
327327
require "scrypt" unless defined?(::SCrypt)
328-
hash = SCrypt::Engine.__sc_crypt(bytes, bytes, 1024, 1, 1, 32)
328+
hash = SCrypt::Engine.scrypt(bytes, bytes, 1024, 1, 1, 32)
329329
rescue LoadError
330330
hash = Litecoin::Scrypt.scrypt_1024_1_1_256_sp(bytes)
331331
end

lib/bitcoin/key.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def to_bip38(passphrase)
183183
addresshash = Digest::SHA256.digest( Digest::SHA256.digest( self.addr ) )[0...4]
184184

185185
require 'scrypt' unless defined?(::SCrypt::Engine)
186-
buf = SCrypt::Engine.__sc_crypt(passphrase, addresshash, 16384, 8, 8, 64)
186+
buf = SCrypt::Engine.scrypt(passphrase, addresshash, 16384, 8, 8, 64)
187187
derivedhalf1, derivedhalf2 = buf[0...32], buf[32..-1]
188188

189189
aes = proc{|k,a,b|
@@ -212,7 +212,7 @@ def self.from_bip38(encrypted_privkey, passphrase)
212212
raise "Invalid checksum" unless Digest::SHA256.digest(Digest::SHA256.digest(version + flagbyte + addresshash + encryptedhalf1 + encryptedhalf2))[0...4] == checksum
213213

214214
require 'scrypt' unless defined?(::SCrypt::Engine)
215-
buf = SCrypt::Engine.__sc_crypt(passphrase, addresshash, 16384, 8, 8, 64)
215+
buf = SCrypt::Engine.scrypt(passphrase, addresshash, 16384, 8, 8, 64)
216216
derivedhalf1, derivedhalf2 = buf[0...32], buf[32..-1]
217217

218218
aes = proc{|k,a|

lib/bitcoin/litecoin.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def xor_salsa8(a, b, a_offset, b_offset)
6868

6969
begin
7070
require "scrypt"
71-
hash = SCrypt::Engine.__sc_crypt(secret_bytes, secret_bytes, 1024, 1, 1, 32)
71+
hash = SCrypt::Engine.scrypt(secret_bytes, secret_bytes, 1024, 1, 1, 32)
7272
p hash.reverse.unpack("H*")[0] == "00000000002bef4107f882f6115e0b01f348d21195dacd3582aa2dabd7985806"
7373
rescue LoadError
7474
puts "scrypt gem not found, using native scrypt"
@@ -77,7 +77,7 @@ def xor_salsa8(a, b, a_offset, b_offset)
7777

7878
require 'benchmark'
7979
Benchmark.bmbm{|x|
80-
x.report("v1"){ SCrypt::Engine.__sc_crypt(secret_bytes, secret_bytes, 1024, 1, 1, 32).reverse.unpack("H*") rescue nil }
80+
x.report("v1"){ SCrypt::Engine.scrypt(secret_bytes, secret_bytes, 1024, 1, 1, 32).reverse.unpack("H*") rescue nil }
8181
x.report("v2"){ Litecoin::Scrypt.scrypt_1024_1_1_256_sp(secret_bytes).reverse.unpack("H*")[0] }
8282
}
8383
end

0 commit comments

Comments
 (0)