wip: Add the basics for the Double Ratchet

This commit is contained in:
2022-08-02 18:13:14 +02:00
parent 56ae882aa0
commit d3c8d813a9
11 changed files with 652 additions and 11 deletions

15
lib/src/helpers.dart Normal file
View File

@@ -0,0 +1,15 @@
/// Flattens [inputs] and concatenates the elements.
List<int> concat(List<List<int>> inputs) {
final tmp = List<int>.empty(growable: true);
for (final input in inputs) {
tmp.addAll(input);
}
return tmp;
}
List<int> pkcs7padding(List<int> input, int size) {
final paddingLength = size - input.length % size;
final padding = List<int>.filled(paddingLength, 0x0);
return concat([input, padding]);
}