module NamedInformation
Overview
implementation of rfc6920
Defined in:
named_information.crConstant Summary
-
ALGORITHM_ID =
{"1" => {algorithm: "SHA256", truncate: nil.as(Int32 | ::Nil)}, "2" => {algorithm: "SHA256", truncate: 128.as(Int32 | ::Nil)}, "3" => {algorithm: "SHA256", truncate: 120.as(Int32 | ::Nil)}, "4" => {algorithm: "SHA256", truncate: 96.as(Int32 | ::Nil)}, "5" => {algorithm: "SHA256", truncate: 64.as(Int32 | ::Nil)}, "6" => {algorithm: "SHA256", truncate: 32.as(Int32 | ::Nil)}}
-
VERSION =
"1.0.1"
Class Method Summary
- .algorithm_name(algorithm : String, truncate : Int32 | Nil) : String
- .character_from_code_point(code_point : Int32) : Char
- .code_point_from_character(char : Char) : Int32
- .convert_to_human_speakable(hash : Bytes, algorithm_name : String, checkdigit : Bool) : String
- .generate_bin(content : String | Bytes, truncate : Int32 | Nil = nil, algorithm : String = "SHA256") : BinHash
- .generate_hash(content : String | Bytes, authority : String | Nil = nil, truncate : Int32 | Nil = nil, algorithm : String = "SHA256") : Hash
- .generate_human_speakable(content : String | Bytes, truncate : Int32 | Nil = nil, algorithm : String | Int32 = "SHA256", checkdigit : Bool = true) : String
- .generate_segment(content : String | Bytes, truncate : Int32 | Nil = nil, algorithm : String = "SHA256") : String
- .generate_u128(content : String | Bytes) : UInt128
- .generate_uri(content : String | Bytes, authority : String | Nil = nil, truncate : Int32 | Nil = nil, algorithm : String = "SHA256") : String
- .generate_well_known(content : String | Bytes, authority : String | Nil = nil, truncate : Int32 | Nil = nil, algorithm : String = "SHA256") : String
-
.hash_content(content : String | Bytes, algorithm : String, truncate : Int32 | Nil = nil)
Return hash of the content using the given algorithm, with optional truncation
-
.luhn_checkdigit(input : String, n : Int32 = 16) : Char
Compute the Luhn check digit for a given number string
Class Method Detail
def self.convert_to_human_speakable(hash : Bytes, algorithm_name : String, checkdigit : Bool) : String
#
def self.generate_bin(content : String | Bytes, truncate : Int32 | Nil = nil, algorithm : String = "SHA256") : BinHash
#
def self.generate_hash(content : String | Bytes, authority : String | Nil = nil, truncate : Int32 | Nil = nil, algorithm : String = "SHA256") : Hash
#
def self.generate_human_speakable(content : String | Bytes, truncate : Int32 | Nil = nil, algorithm : String | Int32 = "SHA256", checkdigit : Bool = true) : String
#
def self.generate_segment(content : String | Bytes, truncate : Int32 | Nil = nil, algorithm : String = "SHA256") : String
#
def self.generate_uri(content : String | Bytes, authority : String | Nil = nil, truncate : Int32 | Nil = nil, algorithm : String = "SHA256") : String
#
def self.generate_well_known(content : String | Bytes, authority : String | Nil = nil, truncate : Int32 | Nil = nil, algorithm : String = "SHA256") : String
#
def self.hash_content(content : String | Bytes, algorithm : String, truncate : Int32 | Nil = nil)
#
Return hash of the content using the given algorithm, with optional truncation
def self.luhn_checkdigit(input : String, n : Int32 = 16) : Char
#
Compute the Luhn check digit for a given number string