Documentation fixes.

master
Didactic Drunk 2019-08-06 16:45:20 -07:00
parent d34bcb49f4
commit 8ed9f94ead
4 changed files with 19 additions and 10 deletions

View File

@ -20,17 +20,25 @@ module Sodium::Digest
include OpenSSL::DigestBase
include Wipe
KEY_SIZE = LibSodium.crypto_generichash_blake2b_keybytes.to_i # 32
KEY_SIZE_MIN = LibSodium.crypto_generichash_blake2b_keybytes_min.to_i # 16
KEY_SIZE_MAX = LibSodium.crypto_generichash_blake2b_keybytes_max.to_i # 64
# 32
KEY_SIZE = LibSodium.crypto_generichash_blake2b_keybytes.to_i
# 16
KEY_SIZE_MIN = LibSodium.crypto_generichash_blake2b_keybytes_min.to_i
# 64
KEY_SIZE_MAX = LibSodium.crypto_generichash_blake2b_keybytes_max.to_i
SALT_SIZE = LibSodium.crypto_generichash_blake2b_saltbytes.to_i # 16
# 16
SALT_SIZE = LibSodium.crypto_generichash_blake2b_saltbytes.to_i
PERSONAL_SIZE = LibSodium.crypto_generichash_blake2b_personalbytes.to_i # 16
# 16
PERSONAL_SIZE = LibSodium.crypto_generichash_blake2b_personalbytes.to_i
OUT_SIZE = LibSodium.crypto_generichash_blake2b_bytes.to_i32 # 32
OUT_SIZE_MIN = LibSodium.crypto_generichash_blake2b_bytes_min.to_i32 # 16
OUT_SIZE_MAX = LibSodium.crypto_generichash_blake2b_bytes_max.to_i32 # 64
# 32
OUT_SIZE = LibSodium.crypto_generichash_blake2b_bytes.to_i32
# 16
OUT_SIZE_MIN = LibSodium.crypto_generichash_blake2b_bytes_min.to_i32
# 64
OUT_SIZE_MAX = LibSodium.crypto_generichash_blake2b_bytes_max.to_i32
getter digest_size

View File

@ -5,8 +5,6 @@ require "./wipe"
module Sodium
# Key derivation function
#
# Read **each** constructor WARNING for differences in usage.
#
# Usage:
# ```
# kdf = KDF.new
@ -20,6 +18,7 @@ module Sodium
KEY_SIZE = LibSodium.crypto_kdf_keybytes.to_i
CONTEXT_SIZE = LibSodium.crypto_kdf_contextbytes
# Returns key
delegate to_slice, to: @sbuf
# Use an existing KDF key.

View File

@ -13,6 +13,7 @@ module Sodium
getter? used
@used = false
# Returns bytes
delegate to_slice, to: @bytes
def initialize(@bytes : Bytes)

View File

@ -45,6 +45,7 @@ module Sodium
LibSodium.sodium_free @ptr
end
# Returns key
def to_slice
Slice(UInt8).new @ptr, @bytesize
end