Skip to content

Commit 00a1286

Browse files
committed
up
1 parent f433407 commit 00a1286

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

crypto-lite/README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ All-in-one "best-of-both-worlds" helper - first hash with sha256 and than hash w
227227

228228

229229
``` ruby
230-
hash160( '02b9d1cc0b793b03b9f64d022e9c67d5f32670b03f636abf0b3147b34123d13990' ).hexdigest
230+
hash160( hex: '02b9d1cc0b793b03b9f64d022e9c67d5f32670b03f636abf0b3147b34123d13990' ).hexdigest
231231
#=> "e6b145a3908a4d6616b13c1109717add8672c900"
232232

233-
hash160( '02b4632d08485ff1df2db55b9dafd23347d1c47a457072a1e87be26896549a8737' ).hexdigest
233+
hash160( hex: '02b4632d08485ff1df2db55b9dafd23347d1c47a457072a1e87be26896549a8737' ).hexdigest
234234
#=> "93ce48570b55c42c2af816aeaba06cfee1224fae"
235235
```
236236

@@ -245,10 +245,11 @@ All-in-one double sha256 hash helper, that is, first hash with sha256 and than h
245245
246246

247247
``` ruby
248-
hash256( '6fe6b145a3908a4d6616b13c1109717add8672c900' ).hexdigest
248+
hash256( hex: '6fe6b145a3908a4d6616b13c1109717add8672c900' ).hexdigest
249249
#=> "02335f08b8fe4ddad263a50b7a33c5d38ea1cbd8fd2056a1320a3ddece541711"
250250
```
251251

252+
252253
#### Base58 Encoding / Decoding Helpers
253254

254255
**BASE58**
@@ -341,7 +342,7 @@ Sign a transaction with an (elliptic curve) private key:
341342
``` ruby
342343
# Step 1 - Calculate the Transaction (tx) Hash
343344
tx = 'from: Alice to: Bob cryptos: 43_000_000_000'
344-
txhash = sha256( tx ).hexdigest
345+
txhash = sha256( tx )
345346

346347
# Step 2 - Get the Signer's Private key
347348
private_key = EC::PrivateKey.new( 1234 ) # This private key is just an example. It should be much more secure!
@@ -368,7 +369,7 @@ Verify a signed transaction with an (elliptic curve) public key:
368369
``` ruby
369370
# Step 1 - Calculate the Transaction (tx) Hash
370371
tx = 'from: Alice to: Bob cryptos: 43_000_000_000'
371-
txhash = sha256( tx ).hexdigest
372+
txhash = sha256( tx )
372373

373374
# Step 2 - Get the Signer's Public Key
374375
public_key = EC::PublicKey.new(

crypto-lite/sandbox/test_sign.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@
9797

9898

9999
tx = "from: alice, to: bob, $21"
100-
pp tx_hash = sha256( tx ).hexdigest
100+
tx_hash = sha256( tx )
101+
pp tx_hash.hexdigest
101102
#=> "426a472a6c69bf68354391b7822393bea3952cde9df8949ad7a0f5f405b2fcb5"
102103

103104
puts "---"
@@ -113,7 +114,8 @@
113114
#=> true
114115

115116
tx = "from: alice, to: bob, $22"
116-
pp tx_hash = sha256( tx ).hexdigest
117+
tx_hash = sha256( tx )
118+
pp tx_hash.hexdigest
117119
#=> "e899604bb4c95d2f1a7cfe561ad65941769e2064bdbbcaa79eb64ce0a2832380"
118120

119121
pp RSA.valid_signature?( tx_hash, tx_signature, alice_pub )

0 commit comments

Comments
 (0)