Class: WSS4R::Security::Util::HashUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/wss4r/security/util/hash_util.rb

Class Method Summary collapse

Class Method Details

.byte_array(string) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/wss4r/security/util/hash_util.rb', line 26

def HashUtil::byte_array(string)
	ret=""
	0.upto(string.size()-1) {|i|
		ret = ret + string[i].to_s() + ","
	}
	ret=ret[0..-2]
	ret
end

.hash_encode64(value) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/wss4r/security/util/hash_util.rb', line 8

def HashUtil::hash_encode64(value)
	#zwei chr sind ein Hex-Wert
	#wenn positiv -> passt
	#wenn negativ -> wert = 256+chr_wert
	j=0
	ret = (" " * (value.size()/2))
	0.step((value.size()-1),2) {|i|
		hex = value[i..i+1].hex()
		if (hex > 0)
			ret[j] = hex
		elsif
			ret[j] = 256+(hex)
		end
		j=j+1
	}
	Base64.encode64(ret)
end