From 8ed9f94eadd6d188416637c22f3038680489b6f2 Mon Sep 17 00:00:00 2001 From: Didactic Drunk <1479616+didactic-drunk@users.noreply.github.com> Date: Tue, 6 Aug 2019 16:45:20 -0700 Subject: [PATCH] Documentation fixes. --- src/sodium/digest/blake2b.cr | 24 ++++++++++++++++-------- src/sodium/kdf.cr | 3 +-- src/sodium/nonce.cr | 1 + src/sodium/secure_buffer.cr | 1 + 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/sodium/digest/blake2b.cr b/src/sodium/digest/blake2b.cr index 69e8487..eedea95 100644 --- a/src/sodium/digest/blake2b.cr +++ b/src/sodium/digest/blake2b.cr @@ -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 diff --git a/src/sodium/kdf.cr b/src/sodium/kdf.cr index 2be7b4f..94ba779 100644 --- a/src/sodium/kdf.cr +++ b/src/sodium/kdf.cr @@ -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. diff --git a/src/sodium/nonce.cr b/src/sodium/nonce.cr index 6b6c7fe..c94abdd 100644 --- a/src/sodium/nonce.cr +++ b/src/sodium/nonce.cr @@ -13,6 +13,7 @@ module Sodium getter? used @used = false + # Returns bytes delegate to_slice, to: @bytes def initialize(@bytes : Bytes) diff --git a/src/sodium/secure_buffer.cr b/src/sodium/secure_buffer.cr index df2ba81..ded73a8 100644 --- a/src/sodium/secure_buffer.cr +++ b/src/sodium/secure_buffer.cr @@ -45,6 +45,7 @@ module Sodium LibSodium.sodium_free @ptr end + # Returns key def to_slice Slice(UInt8).new @ptr, @bytesize end