Class: Google::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5HashList

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/safebrowsing_v5/classes.rb,
lib/google/apis/safebrowsing_v5/representations.rb,
lib/google/apis/safebrowsing_v5/representations.rb

Overview

A list of hashes identified by its name.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleSecuritySafebrowsingV5HashList

Returns a new instance of GoogleSecuritySafebrowsingV5HashList.



209
210
211
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 209

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#additions_eight_bytesGoogle::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5RiceDeltaEncoded64Bit

Same as RiceDeltaEncoded32Bit except this encodes 64-bit numbers. Corresponds to the JSON property additionsEightBytes



115
116
117
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 115

def additions_eight_bytes
  @additions_eight_bytes
end

#additions_four_bytesGoogle::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5RiceDeltaEncoded32Bit

The Rice-Golomb encoded data. Used for either hashes or removal indices. It is guaranteed that every hash or index here has the same length, and this length is exactly 32 bits. Generally speaking, if we sort all the entries lexicographically, we will find that the higher order bits tend not to change as frequently as lower order bits. This means that if we also take the adjacent difference between entries, the higher order bits have a high probability of being zero. This exploits this high probability of zero by essentially choosing a certain number of bits; all bits more significant than this are likely to be zero so we use unary encoding. See the rice_parameter field. Historical note: the Rice-delta encoding was first used in V4 of this API. In V5, two significant improvements were made: firstly, the Rice-delta encoding is now available with hash prefixes longer than 4 bytes; secondly, the encoded data are now treated as big-endian so as to avoid a costly sorting step. Corresponds to the JSON property additionsFourBytes



133
134
135
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 133

def additions_four_bytes
  @additions_four_bytes
end

#additions_sixteen_bytesGoogle::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5RiceDeltaEncoded128Bit

Same as RiceDeltaEncoded32Bit except this encodes 128-bit numbers. Corresponds to the JSON property additionsSixteenBytes



138
139
140
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 138

def additions_sixteen_bytes
  @additions_sixteen_bytes
end

#additions_thirty_two_bytesGoogle::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5RiceDeltaEncoded256Bit

Same as RiceDeltaEncoded32Bit except this encodes 256-bit numbers. Corresponds to the JSON property additionsThirtyTwoBytes



143
144
145
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 143

def additions_thirty_two_bytes
  @additions_thirty_two_bytes
end

#compressed_removalsGoogle::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5RiceDeltaEncoded32Bit

The Rice-Golomb encoded data. Used for either hashes or removal indices. It is guaranteed that every hash or index here has the same length, and this length is exactly 32 bits. Generally speaking, if we sort all the entries lexicographically, we will find that the higher order bits tend not to change as frequently as lower order bits. This means that if we also take the adjacent difference between entries, the higher order bits have a high probability of being zero. This exploits this high probability of zero by essentially choosing a certain number of bits; all bits more significant than this are likely to be zero so we use unary encoding. See the rice_parameter field. Historical note: the Rice-delta encoding was first used in V4 of this API. In V5, two significant improvements were made: firstly, the Rice-delta encoding is now available with hash prefixes longer than 4 bytes; secondly, the encoded data are now treated as big-endian so as to avoid a costly sorting step. Corresponds to the JSON property compressedRemovals



161
162
163
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 161

def compressed_removals
  @compressed_removals
end

#metadataGoogle::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5HashListMetadata

Metadata about a particular hash list. Corresponds to the JSON property metadata



166
167
168
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 166

def 
  @metadata
end

#minimum_wait_durationString

Clients should wait at least this long to get the hash list again. If omitted or zero, clients SHOULD fetch immediately because it indicates that the server has an additional update to be sent to the client, but could not due to the client-specified constraints. Corresponds to the JSON property minimumWaitDuration

Returns:

  • (String)


174
175
176
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 174

def minimum_wait_duration
  @minimum_wait_duration
end

#nameString

The name of the hash list. Note that the Global Cache is also just a hash list and can be referred to here. Corresponds to the JSON property name

Returns:

  • (String)


180
181
182
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 180

def name
  @name
end

#partial_updateBoolean Also known as: partial_update?

When true, this is a partial diff containing additions and removals based on what the client already has. When false, this is the complete hash list. When false, the client MUST delete any locally stored version for this hash list. This means that either the version possessed by the client is seriously out-of- date or the client data is believed to be corrupt. The compressed_removals field will be empty. When true, the client MUST apply an incremental update by applying removals and then additions. Corresponds to the JSON property partialUpdate

Returns:

  • (Boolean)


191
192
193
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 191

def partial_update
  @partial_update
end

#sha256_checksumString

The sorted list of all hashes, hashed again with SHA256. This is the checksum for the sorted list of all hashes present in the database after applying the provided update. In the case that no updates were provided, the server will omit this field to indicate that the client should use the existing checksum. Corresponds to the JSON property sha256Checksum NOTE: Values are automatically base64 encoded/decoded in the client library.

Returns:

  • (String)


201
202
203
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 201

def sha256_checksum
  @sha256_checksum
end

#versionString

The version of the hash list. The client MUST NOT manipulate those bytes. Corresponds to the JSON property version NOTE: Values are automatically base64 encoded/decoded in the client library.

Returns:

  • (String)


207
208
209
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 207

def version
  @version
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 214

def update!(**args)
  @additions_eight_bytes = args[:additions_eight_bytes] if args.key?(:additions_eight_bytes)
  @additions_four_bytes = args[:additions_four_bytes] if args.key?(:additions_four_bytes)
  @additions_sixteen_bytes = args[:additions_sixteen_bytes] if args.key?(:additions_sixteen_bytes)
  @additions_thirty_two_bytes = args[:additions_thirty_two_bytes] if args.key?(:additions_thirty_two_bytes)
  @compressed_removals = args[:compressed_removals] if args.key?(:compressed_removals)
  @metadata = args[:metadata] if args.key?(:metadata)
  @minimum_wait_duration = args[:minimum_wait_duration] if args.key?(:minimum_wait_duration)
  @name = args[:name] if args.key?(:name)
  @partial_update = args[:partial_update] if args.key?(:partial_update)
  @sha256_checksum = args[:sha256_checksum] if args.key?(:sha256_checksum)
  @version = args[:version] if args.key?(:version)
end