IPWorks Encrypt 2020 Python Edition

Questions / Feedback?

key Property

The secret key for the hash algorithm.

Syntax

def get_key() -> bytes: ...
def set_key(value: bytes) -> None: ...

key = property(get_key, set_key)

Default Value

""

Remarks

This property holds the secret key used when creating the hash. The key can be arbitrarily long.

Note: This property is only applicable when algorithm is set to an HMAC algorithm.

It is recommended that the length of the key be equal to or larger than the hash size of the algorithm. Use of keys shorter than the hash size is discouraged.

Sizes (in bytes)

SHA1SHA224SHA256SHA384SHA512MD5RIPEMD160
Recommended Key Size20 28 32 48 64 16 20
Hash Size 20 28 32 48 64 16 20
Block Size 64 64 64 128 128 64 64

Key Length Details

As mentioned above it is recommended to use a key size equal to the hash size. Use of keys larger than the hash size does not typically significantly increase the function strength. Keys of any length are technically valid however see the below processing rules to understand how keys of varying lengths are treated:

  • If the key length is equal to the hash size (recommended) it is used without modification.
  • If the key length is less than the hash size it is used without modification.
  • If the key length is less than or equal to the block size it is used without modification.
  • If the key length is larger than the block size is it first hashed with the same algorithm.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Encrypt 2020 Python Edition - Version 20.0 [Build 8155]