lib/bech32.rb in bech32-1.0.2 vs lib/bech32.rb in bech32-1.0.3
- old
+ new
@@ -32,9 +32,11 @@
# <i>Generates:</i>
# 'bc' # hrp
# [0, 14, 20, 15, 7, 13, 26, 0, 25, 18, 6, 11, 13, 8, 21, 4, 20, 3, 17, 2, 29, 3, 12, 29, 3, 4, 15, 24, 20, 6, 14, 30, 22] # data
#
def decode(bech)
+ # check invalid bytes
+ return nil if bech.scrub('?').include?('?')
# check uppercase/lowercase
return nil if (bech.downcase != bech && bech.upcase != bech)
bech.each_char{|c|return nil if c.ord < 33 || c.ord > 126}
bech = bech.downcase
# check data length
\ No newline at end of file