padding32Bytes function

String padding32Bytes(
  1. String hex
)

Implementation

String padding32Bytes(String hex) {
  /// The hex must be divisible by 32 without remainder. If this is not the case, then zeros are inserted to the right until the value is divisible by
  /// 32. This is important for the Poly1305 because it consists of four elements of a block.
  if (hex.length % 32 != 0) {
    hex = hex.padRight(32 * (hex.length / 32).ceil(), "0");
  }

  return hex;
}