mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
crypto: add missing doc comments for public methods (#23864)
This commit is contained in:
parent
e467747fe4
commit
3aed78e76a
@ -63,6 +63,7 @@ fn new_cfb(b Block, iv []u8, decrypt bool) Cfb {
|
||||
return x
|
||||
}
|
||||
|
||||
// xor_key_stream xors each byte in the given slice with a byte from the key stream.
|
||||
pub fn (mut x Cfb) xor_key_stream(mut dst []u8, src []u8) {
|
||||
unsafe {
|
||||
mut local_dst := *dst
|
||||
|
@ -49,6 +49,7 @@ pub fn new_ctr(b Block, iv []u8) Ctr {
|
||||
}
|
||||
}
|
||||
|
||||
// xor_key_stream xors each byte in the given slice with a byte from the key stream.
|
||||
pub fn (mut x Ctr) xor_key_stream(mut dst []u8, src []u8) {
|
||||
unsafe {
|
||||
mut local_dst := *dst
|
||||
|
@ -35,6 +35,7 @@ pub fn new_ofb(b Block, iv []u8) Ofb {
|
||||
return x
|
||||
}
|
||||
|
||||
// xor_key_stream xors each byte in the given slice with a byte from the key stream.
|
||||
pub fn (mut x Ofb) xor_key_stream(mut dst []u8, src []u8) {
|
||||
unsafe {
|
||||
mut local_dst := *dst
|
||||
|
@ -56,6 +56,7 @@ fn (mut c DesCipher) generate_subkeys(key_bytes []u8) {
|
||||
}
|
||||
}
|
||||
|
||||
// encrypt a block of data using the DES algorithm
|
||||
pub fn (c &DesCipher) encrypt(mut dst []u8, src []u8) {
|
||||
if src.len < block_size {
|
||||
panic('crypto/des: input not full block')
|
||||
@ -69,6 +70,7 @@ pub fn (c &DesCipher) encrypt(mut dst []u8, src []u8) {
|
||||
encrypt_block(c.subkeys[..], mut dst, src)
|
||||
}
|
||||
|
||||
// decrypt a block of data using the DES algorithm
|
||||
pub fn (c &DesCipher) decrypt(mut dst []u8, src []u8) {
|
||||
if src.len < block_size {
|
||||
panic('crypto/des: input not full block')
|
||||
@ -94,6 +96,7 @@ pub fn new_triple_des_cipher(key []u8) cipher.Block {
|
||||
return c
|
||||
}
|
||||
|
||||
// encrypt a block of data using the TripleDES algorithm
|
||||
pub fn (c &TripleDesCipher) encrypt(mut dst []u8, src []u8) {
|
||||
if src.len < block_size {
|
||||
panic('crypto/des: input not full block')
|
||||
@ -130,6 +133,7 @@ pub fn (c &TripleDesCipher) encrypt(mut dst []u8, src []u8) {
|
||||
binary.big_endian_put_u64(mut dst, permute_final_block(pre_output))
|
||||
}
|
||||
|
||||
// decrypt a block of data using the TripleDES algorithm
|
||||
pub fn (c &TripleDesCipher) decrypt(mut dst []u8, src []u8) {
|
||||
if src.len < block_size {
|
||||
panic('crypto/des: input not full block')
|
||||
|
@ -8,6 +8,7 @@ struct ReadError {
|
||||
Error
|
||||
}
|
||||
|
||||
// msg returns the error message.
|
||||
pub fn (err ReadError) msg() string {
|
||||
return 'crypto.rand.read() error reading random bytes'
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user