ANSI X9.31 hash format

With ANSI X9.31, the string that is processed by the RSA algorithm is formatted by the concatenation of a header, padding, the hash and a trailer, from the most significant bit to the least significant bit, such that the resulting string is the same length as the modulus of the key. For the ICSF implementation, the modulus length must be a multiple of 8 bits.

  • The header consists of X'6B'
  • The padding consists of X'BB', repeated as many times as required, and terminated by X'BA'
  • The hash value follows the padding
  • The trailer consists of a hashing mechanism specifier and final byte. These specifiers are defined:
    • X'31': RIPEMD-160
    • X'33': SHA-1
    • X'34': SHA-256
    • X'35': SHA-512
    • X'36': SHA-384
  • A final byte of X'CC'.