class TrisulRP::Keys::Host
Public Class Methods
invert_xform(dstring) { |ret| ... }
click to toggle source
human string to key
# File lib/trisulrp/keys.rb, line 54 def self.invert_xform(dstring) ret = dstring.split('.').collect { |decbyte| decbyte.to_i.to_s(16).rjust(2,"00").upcase}.join('.') yield ret if block_given? ret end
is_human_form?(patt)
click to toggle source
is_human_pattern?
# File lib/trisulrp/keys.rb, line 67 def self.is_human_form? patt patt.split('.').select { |szbyte| (1..255).cover?(szbyte.to_i) or szbyte.squeeze("0") == "0" }.size == 4 end
is_key_form?(patt)
click to toggle source
is_key_pattern?
# File lib/trisulrp/keys.rb, line 61 def self.is_key_form? patt return false if patt.nil? patt.length == 11 and (patt[2] == "." || patt[5] == "." || patt[8] == ".") end
xform(kstring) { |ret| ... }
click to toggle source
key to human string
# File lib/trisulrp/keys.rb, line 47 def self.xform(kstring) ret = kstring.split('.').collect { |hexbyte| hexbyte.hex.to_s }.join('.') yield ret if block_given? ret end