-
Notifications
You must be signed in to change notification settings - Fork 181
Implement belt dwp #604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement belt dwp #604
Changes from 1 commit
08d7a7e
35c591d
f91b95c
d005883
9197ed7
f3453d4
893fcd7
0f8ecb4
6bb004d
d783635
a3c7434
c0ac13a
5b771fc
6a955f7
d1d3e6f
854d183
c806f30
54b3208
547f19a
b8c8c00
360216f
669aee7
8fe1573
1bb3d47
989ca57
32ac38a
46e01d3
2e5a142
a198446
f95b3f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| use aead::AeadInPlaceDetached; | ||
| use belt_dwp::{BeltDwp, KeyInit}; | ||
| use belt_block::BeltBlock; | ||
| use belt_dwp::KeyInit; | ||
| use hex_literal::hex; | ||
|
|
||
| type BeltDwp = belt_dwp::BeltDwp<BeltBlock>; | ||
|
||
|
|
||
| /// Test from Appendix A, tables 19-20 of STB 34.101.31-2020: | ||
| /// https://apmi.bsu.by/assets/files/std/belt-spec372.pdf | ||
| #[test] | ||
|
|
@@ -36,11 +39,11 @@ fn test_belt_dwp() { | |
|
|
||
| for vec in test_vectors { | ||
| let mut x = vec.x; | ||
| let beltdwp = BeltDwp::new_from_slice(&vec.k).unwrap(); | ||
| let tag = beltdwp.encrypt_in_place_detached(&vec.s.into(), &vec.i, &mut x); | ||
| let belt_dwp = BeltDwp::new_from_slice(&vec.k).unwrap(); | ||
| let tag = belt_dwp.encrypt_in_place_detached(&vec.s.into(), &vec.i, &mut x); | ||
| assert_eq!(vec.t, *tag.unwrap()); | ||
| assert_eq!(vec.y, x); | ||
| beltdwp | ||
| belt_dwp | ||
| .decrypt_in_place_detached(&vec.s.into(), &vec.i, &mut x, &tag.unwrap()) | ||
| .unwrap(); | ||
| assert_eq!(x, vec.x); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.