v / vlib / crypto / aes / cypher_generic.v
18 lines · 16 sloc · 512 bytes · 763f94388b1ceff59c3e68ebda2c9f57197f32a4
Raw
1// Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved.
2// Use of this source code is governed by an MIT license
3// that can be found in the LICENSE file.
4module aes
5
6import crypto.cipher
7
8// new_cipher_generic creates and returns a new cipher.Block
9// this is the generiv v version, no arch optimisations
10fn new_cipher_generic(key []u8) cipher.Block {
11 n := key.len + 28
12 mut c := AesCipher{
13 enc: []u32{len: n}
14 dec: []u32{len: n}
15 }
16 expand_key_generic(key, mut c.enc, mut c.dec)
17 return c
18}
19