lib/ctf_party/hex.rb in ctf-party-1.2.0 vs lib/ctf_party/hex.rb in ctf-party-1.2.1
- old
+ new
@@ -76,12 +76,13 @@
opts[:prefix] ||= ''
opts[:case] ||= :lower
opts[:nibble] ||= :high
# convert
out = ''
- if opts[:nibble] == :high
+ case opts[:nibble]
+ when :high
out = unpack1('H*')
- elsif opts[:nibble] == :low
+ when :low
out = unpack1('h*')
end
# char case management
out = out.upcase if opts[:case] == :upper
# adding prefix must be done after case change