module Crypto

Overview

wraps various hasing functions for convenience

Defined in:

crypto.cr

Constant Summary

BASE_57 = "23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

the base-57 alphabet (for mini private keys)

BASE_58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

the base-58 alphabet (for bitcoin)

Class Method Summary

Class Method Detail

def self.base57_char(i : Int32) #

get a character from the base-57 alphabet at position i


[View source]
def self.base58_decode(s : String) #

decode a hex string from base-58


[View source]
def self.base58_encode(h : String) #

encode a hex string as base-58


[View source]
def self.bin_to_hex(b : Bytes) #

helper function to convert byte arrays to hex strings


[View source]
def self.hex_to_bin(s : String) #

helper function to convert hex strings to byte arrays


[View source]
def self.keccak256(h : String) #

operating a keccak-256 hash on the byte array


[View source]
def self.keccak256_string(h : String) #

operating a keccak-256 hash on the actual string literal


[View source]
def self.ripemd160(h : String) #

operating a ripemd-160 hash on the byte array


[View source]
def self.sha256(h : String) #

operating a sha2-256 hash on the byte array


[View source]
def self.sha256_string(h : String) #

operating a sha2-256 hash on the actual string literal


[View source]
def self.sha3(h : String) #

operating a sha3-256 hash on the byte array


[View source]
def self.sha3_string(h : String) #

operating a sha3-256 hash on the actual string literal


[View source]