Skip to content

Commit

Permalink
run v fmt -w .
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed Jun 28, 2024
1 parent 88ab052 commit f2fb4a2
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 45 deletions.
10 changes: 4 additions & 6 deletions aead/xchacha20poly1305_ietf/xchacha20poly1305_ietf.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ module xchacha20poly1305_ietf
import libsodium
import math

const (
crypto_aead_xchacha20poly1305_ietf_abytes = libsodium.crypto_aead_xchacha20poly1305_ietf_abytes()
crypto_aead_xchacha20poly1305_ietf_keybytes = libsodium.crypto_aead_xchacha20poly1305_ietf_keybytes()
crypto_aead_xchacha20poly1305_ietf_npubbytes = libsodium.crypto_aead_xchacha20poly1305_ietf_npubbytes()
crypto_aead_xchacha20poly1305_ietf_messagebytes_max = libsodium.crypto_aead_xchacha20poly1305_ietf_messagebytes_max()
)
const crypto_aead_xchacha20poly1305_ietf_abytes = libsodium.crypto_aead_xchacha20poly1305_ietf_abytes()
const crypto_aead_xchacha20poly1305_ietf_keybytes = libsodium.crypto_aead_xchacha20poly1305_ietf_keybytes()
const crypto_aead_xchacha20poly1305_ietf_npubbytes = libsodium.crypto_aead_xchacha20poly1305_ietf_npubbytes()
const crypto_aead_xchacha20poly1305_ietf_messagebytes_max = libsodium.crypto_aead_xchacha20poly1305_ietf_messagebytes_max()

// modeled after https://doc.libsodium.org/secret-key_cryptography/aead/chacha20-poly1305/xchacha20-poly1305_construction

Expand Down
8 changes: 3 additions & 5 deletions common.v
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module libsodium

const (
crypto_pwhash_argon2id_saltbytes = crypto_pwhash_argon2id_saltbytes()
crypto_pwhash_passwd_min = crypto_pwhash_passwd_min()
crypto_pwhash_passwd_max = crypto_pwhash_passwd_max()
)
const crypto_pwhash_argon2id_saltbytes = crypto_pwhash_argon2id_saltbytes()
const crypto_pwhash_passwd_min = crypto_pwhash_passwd_min()
const crypto_pwhash_passwd_max = crypto_pwhash_passwd_max()

// modeled after https://doc.libsodium.org/password_hashing/default_phf

Expand Down
16 changes: 9 additions & 7 deletions secret_box.v
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
module libsodium

pub const (
key_size = 32 // int(C.crypto_secretbox_KEYBYTES)
nonce_size = 24 // int(C.crypto_secretbox_NONCEBYTES)
mac_size = 16 // int(C.crypto_secretbox_MACBYTES)
public_key_size = 32 // int(C.crypto_secretbox_PUBLICKEYBYTES)
secret_key_size = 32 // int(C.crypto_secretbox_PUBLICKEYBYTES)
)
pub const key_size = 32 // int(C.crypto_secretbox_KEYBYTES)

pub const nonce_size = 24 // int(C.crypto_secretbox_NONCEBYTES)

pub const mac_size = 16 // int(C.crypto_secretbox_MACBYTES)

pub const public_key_size = 32 // int(C.crypto_secretbox_PUBLICKEYBYTES)

pub const secret_key_size = 32 // int(C.crypto_secretbox_PUBLICKEYBYTES)

pub struct SecretBox {
nonce [24]u8
Expand Down
10 changes: 4 additions & 6 deletions secretbox/secretbox.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ module secretbox

import libsodium

const (
crypto_secretbox_keybytes = libsodium.crypto_secretbox_keybytes()
crypto_secretbox_macbytes = libsodium.crypto_secretbox_macbytes()
crypto_box_messagebytes_max = libsodium.crypto_box_messagebytes_max()
crypto_box_noncebytes = libsodium.crypto_box_noncebytes()
)
const crypto_secretbox_keybytes = libsodium.crypto_secretbox_keybytes()
const crypto_secretbox_macbytes = libsodium.crypto_secretbox_macbytes()
const crypto_box_messagebytes_max = libsodium.crypto_box_messagebytes_max()
const crypto_box_noncebytes = libsodium.crypto_box_noncebytes()

// https://doc.libsodium.org/secret-key_cryptography/secretbox

Expand Down
4 changes: 1 addition & 3 deletions sign.v
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module libsodium

const (
sign_len = 64
)
const sign_len = 64

pub struct SigningKey {
secret_key [secret_key_size]u8
Expand Down
34 changes: 16 additions & 18 deletions translated.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ type C.UNSIGNED_LONG_LONG = u64

fn C.ULLCAST(x &u64) &C.UNSIGNED_LONG_LONG

const ( // empty enum
blake2b_blockbytes = 0
blake2b_outbytes = 1
blake2b_keybytes = 2
blake2b_saltbytes = 3
blake2b_personalbytes = 4
)
// empty enum
const blake2b_blockbytes = 0
const blake2b_outbytes = 1
const blake2b_keybytes = 2
const blake2b_saltbytes = 3
const blake2b_personalbytes = 4

/*
// struct decl name="blake2b_param_"
Expand Down Expand Up @@ -591,17 +590,16 @@ enum Argon2_type {
argon2_id
}

const ( // empty enum
argon2_version_number = 0
argon2_block_size = 1
argon2_qwords_in_block = 2
argon2_owords_in_block = 3
argon2_hwords_in_block = 4
argon2_512bit_words_in_block = 5
argon2_addresses_in_block = 6
argon2_prehash_digest_length = 7
argon2_prehash_seed_length = 8
)
// empty enum
const argon2_version_number = 0
const argon2_block_size = 1
const argon2_qwords_in_block = 2
const argon2_owords_in_block = 3
const argon2_hwords_in_block = 4
const argon2_512bit_words_in_block = 5
const argon2_addresses_in_block = 6
const argon2_prehash_digest_length = 7
const argon2_prehash_seed_length = 8

// struct decl name="block_"
// typedef struct
Expand Down

0 comments on commit f2fb4a2

Please sign in to comment.