module Keccak

Extended Modules

Defined in:

keccak.cr

Constant Summary

KECCAK_ROTC = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44]
KECCAK_ROUNDS = 24
KECCAKF_PILN = [10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1]
LFSR = 1
OUTPUT_SIZES = [224, 256, 384, 512]
SHAKE_SECURITY_LEVELS = [128, 256]
VERSION = "1.0.0"

Instance Method Summary

Instance Method Detail

def hash(input : String, output_size : Int32, raw_output : Bool = false) : String #

Returns Keccak (not the standardized SHA3) of the given string.

Parameters

  • input - Input string.
  • output_size - Size of returning hash in bits.
  • raw_output - if false returns hex-encoded string, raw bytes otherwise.

Returns String - The SHA3 result of the given string.


[View source]
def hash(input : Bytes, output_size : Int32) : Bytes #

Returns Keccak (not the standardized SHA3) of the given string.

Parameters

  • input - Input bytes.
  • output_size - Size of returning hash in bits.

Returns Bytes - The SHA3 result of the given string.


[View source]
def shake(input : String, security_level : Int32, output_size : Int32, raw_output : Bool = false) : String #

[View source]