Class: EsuApi::Checksum
- Inherits:
-
Object
- Object
- EsuApi::Checksum
- Defined in:
- lib/EsuApi.rb
Constant Summary collapse
- SHA0 =
"SHA0"
Instance Attribute Summary collapse
-
#expected_value ⇒ Object
Returns the value of attribute expected_value.
Instance Method Summary collapse
-
#initialize(algorithm) ⇒ Checksum
constructor
A new instance of Checksum.
- #to_s ⇒ Object
- #update(data) ⇒ Object
Constructor Details
Instance Attribute Details
#expected_value ⇒ Object
Returns the value of attribute expected_value.
1062 1063 1064 |
# File 'lib/EsuApi.rb', line 1062 def expected_value @expected_value end |
Instance Method Details
#to_s ⇒ Object
1052 1053 1054 1055 1056 1057 1058 1059 1060 |
# File 'lib/EsuApi.rb', line 1052 def to_s() value = @hash.clone().hashFinal(nil) hval = "" value.each_byte { |b| hval += "%.2x" % b } return "#{@algorithm}/#{@offset}/#{hval}" end |
#update(data) ⇒ Object
1047 1048 1049 1050 |
# File 'lib/EsuApi.rb', line 1047 def update( data ) @offset += data.length() @hash.hashUpdate( data ) end |