Class: Aws::Plugins::ChecksumAlgorithm::Digest 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 or 64 bit integer checksums (eg CRC32 or CRC64).

Instance Method Summary collapse

Constructor Details

#initialize(digest_fn, directive) ⇒ Digest

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 Digest.



138
139
140
141
142
# File 'lib/aws-sdk-core/plugins/checksum_algorithm.rb', line 138

def initialize(digest_fn, directive)
  @digest_fn = digest_fn
  @directive = directive
  @value = 0
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.



148
149
150
# File 'lib/aws-sdk-core/plugins/checksum_algorithm.rb', line 148

def base64digest
  Base64.encode64([@value].pack(@directive)).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.



144
145
146
# File 'lib/aws-sdk-core/plugins/checksum_algorithm.rb', line 144

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