| ... | @@ -69,6 +69,13 @@ pub fn base64EncodeAlloc(alloc: std.mem.Allocator, input: string) !string { | ... | @@ -69,6 +69,13 @@ pub fn base64EncodeAlloc(alloc: std.mem.Allocator, input: string) !string { |
| 69 | return base64.encode(buf, input); | 69 | return base64.encode(buf, input); |
| 70 | } | 70 | } |
| 71 | | 71 | |
| | 72 | pub fn base64DecodeAlloc(alloc: std.mem.Allocator, input: string) !string { |
| | 73 | const base64 = std.base64.standard.Decoder; |
| | 74 | var buf = try alloc.alloc(u8, try base64.calcSizeForSlice(input)); |
| | 75 | try base64.decode(buf, input); |
| | 76 | return buf; |
| | 77 | } |
| | 78 | |
| 72 | pub fn asciiUpper(alloc: std.mem.Allocator, input: string) ![]u8 { | 79 | pub fn asciiUpper(alloc: std.mem.Allocator, input: string) ![]u8 { |
| 73 | var buf = try alloc.dupe(u8, input); | 80 | var buf = try alloc.dupe(u8, input); |
| 74 | for (0..buf.len) |i| { | 81 | for (0..buf.len) |i| { |