diff options
Diffstat (limited to 'src/nkeys.zig')
-rw-r--r-- | src/nkeys.zig | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/nkeys.zig b/src/nkeys.zig index b8693ae..818fd98 100644 --- a/src/nkeys.zig +++ b/src/nkeys.zig | |||
@@ -211,9 +211,9 @@ const binary_public_size = 1 + Ed25519.public_length + 2; | |||
211 | // Two prefix bytes, two CRC bytes | 211 | // Two prefix bytes, two CRC bytes |
212 | const binary_seed_size = 2 + Ed25519.seed_length + 2; | 212 | const binary_seed_size = 2 + Ed25519.seed_length + 2; |
213 | 213 | ||
214 | pub const text_private_len = base32.encodedLen(binary_private_size); | 214 | pub const text_private_len = base32.Encoder.calcSize(binary_private_size); |
215 | pub const text_public_len = base32.encodedLen(binary_public_size); | 215 | pub const text_public_len = base32.Encoder.calcSize(binary_public_size); |
216 | pub const text_seed_len = base32.encodedLen(binary_seed_size); | 216 | pub const text_seed_len = base32.Encoder.calcSize(binary_seed_size); |
217 | 217 | ||
218 | pub const text_private = [text_private_len]u8; | 218 | pub const text_private = [text_private_len]u8; |
219 | pub const text_public = [text_public_len]u8; | 219 | pub const text_public = [text_public_len]u8; |
@@ -227,8 +227,8 @@ pub fn encodePrivate(key: *const [Ed25519.secret_length]u8) !text_private { | |||
227 | return encode(1, key.len, &[_]u8{@enumToInt(KeyTypePrefixByte.private)}, key); | 227 | return encode(1, key.len, &[_]u8{@enumToInt(KeyTypePrefixByte.private)}, key); |
228 | } | 228 | } |
229 | 229 | ||
230 | fn EncodedKey(comptime prefix_len: usize, comptime data_len: usize) type { | 230 | fn encoded_key(comptime prefix_len: usize, comptime data_len: usize) type { |
231 | return [base32.encodedLen(prefix_len + data_len + 2)]u8; | 231 | return [base32.Encoder.calcSize(prefix_len + data_len + 2)]u8; |
232 | } | 232 | } |
233 | 233 | ||
234 | fn encode( | 234 | fn encode( |
@@ -236,7 +236,7 @@ fn encode( | |||
236 | comptime data_len: usize, | 236 | comptime data_len: usize, |
237 | prefix: *const [prefix_len]u8, | 237 | prefix: *const [prefix_len]u8, |
238 | data: *const [data_len]u8, | 238 | data: *const [data_len]u8, |
239 | ) !EncodedKey(prefix_len, data_len) { | 239 | ) !encoded_key(prefix_len, data_len) { |
240 | var buf: [prefix_len + data_len + 2]u8 = undefined; | 240 | var buf: [prefix_len + data_len + 2]u8 = undefined; |
241 | defer wipeBytes(&buf); | 241 | defer wipeBytes(&buf); |
242 | 242 | ||
@@ -246,8 +246,8 @@ fn encode( | |||
246 | var checksum = crc16.make(buf[0..off]); | 246 | var checksum = crc16.make(buf[0..off]); |
247 | mem.writeIntLittle(u16, buf[buf.len - 2 .. buf.len], checksum); | 247 | mem.writeIntLittle(u16, buf[buf.len - 2 .. buf.len], checksum); |
248 | 248 | ||
249 | var text: EncodedKey(prefix_len, data_len) = undefined; | 249 | var text: encoded_key(prefix_len, data_len) = undefined; |
250 | std.debug.assert(base32.encode(&buf, &text) == text.len); | 250 | _ = base32.Encoder.encode(&text, &buf); |
251 | 251 | ||
252 | return text; | 252 | return text; |
253 | } | 253 | } |
@@ -285,7 +285,7 @@ fn DecodedNKey(comptime prefix_len: usize, comptime data_len: usize) type { | |||
285 | fn decode( | 285 | fn decode( |
286 | comptime prefix_len: usize, | 286 | comptime prefix_len: usize, |
287 | comptime data_len: usize, | 287 | comptime data_len: usize, |
288 | text: *const [base32.encodedLen(prefix_len + data_len + 2)]u8, | 288 | text: *const [base32.Encoder.calcSize(prefix_len + data_len + 2)]u8, |
289 | ) !DecodedNKey(prefix_len, data_len) { | 289 | ) !DecodedNKey(prefix_len, data_len) { |
290 | var raw: [prefix_len + data_len + 2]u8 = undefined; | 290 | var raw: [prefix_len + data_len + 2]u8 = undefined; |
291 | defer wipeBytes(&raw); | 291 | defer wipeBytes(&raw); |