Class: Aws::Plugins::ChecksumAlgorithm::Digest32 Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/plugins/checksum_algorithm.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Interface for computing digests on request/response bodies which may be files, strings or IO like objects Applies only to digest functions that produce 32 bit integer checksums (eg CRC32)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(digest_fn) ⇒ Digest32

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Digest32.

Parameters:

  • digest_fn (Object)


42
43
44
45
# File 'lib/aws-sdk-core/plugins/checksum_algorithm.rb', line 42

def initialize(digest_fn)
  @digest_fn = digest_fn
  @value = 0
end

Instance Attribute Details

#valueObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/aws-sdk-core/plugins/checksum_algorithm.rb', line 39

def value
  @value
end

Instance Method Details

#base64digestObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



51
52
53
# File 'lib/aws-sdk-core/plugins/checksum_algorithm.rb', line 51

def base64digest
  Base64.encode64([@value].pack('N')).chomp
end

#update(chunk) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



47
48
49
# File 'lib/aws-sdk-core/plugins/checksum_algorithm.rb', line 47

def update(chunk)
  @value = @digest_fn.call(chunk, @value)
end