Skip to content

Commit d1eda9c

Browse files
author
Ahmed
committed
Add Array sizes required for NTRU-Prime
1 parent 390b3e4 commit d1eda9c

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

src/sizes.rs

+51-2
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,8 @@ mod extra_sizes {
602602
use super::{ArraySize, AssocArraySize};
603603
use typenum::{
604604
consts::{B0, B1},
605-
UInt, UTerm,
605+
UInt, UTerm, U1007, U1013, U1014, U653, U654, U761, U762, U857, U858, U865, U953, U954,
606+
U994,
606607
};
607608

608609
// This macro constructs a UInt type from a sequence of bits. The bits are interpreted as the
@@ -804,7 +805,23 @@ mod extra_sizes {
804805
pub type U4048 = uint!(0 0 0 0 1 0 1 1 1 1 1 1);
805806
pub type U4064 = uint!(0 0 0 0 0 1 1 1 1 1 1 1);
806807
pub type U4080 = uint!(0 0 0 0 1 1 1 1 1 1 1 1);
807-
808+
//NTRU-PRIME sizes
809+
pub type U1158 = uint!(0 1 1 0 0 0 0 1 0 0 1);
810+
pub type U1277 = uint!(1 0 1 1 1 1 1 1 0 0 1);
811+
pub type U1278 = uint!(0 1 1 1 1 1 1 1 0 0 1);
812+
pub type U1305 = uint!(1 0 0 1 1 0 0 0 1 0 1);
813+
pub type U1317 = uint!(1 0 1 0 0 1 0 0 1 0 1);
814+
pub type U1322 = uint!(0 1 0 1 0 1 0 0 1 0 1);
815+
pub type U1423 = uint!(1 1 1 1 0 0 0 1 1 0 1);
816+
pub type U1505 = uint!(1 0 0 0 0 1 1 1 1 0 1);
817+
pub type U1521 = uint!(1 0 0 0 1 1 1 1 1 0 1);
818+
pub type U1623 = uint!(1 1 1 0 1 0 1 0 0 1 1);
819+
pub type U1713 = uint!(1 0 0 0 1 1 0 1 0 1 1);
820+
pub type U1815 = uint!(1 1 1 0 1 0 0 0 1 1 1);
821+
pub type U1905 = uint!(1 0 0 0 1 1 1 0 1 1 1);
822+
pub type U2025 = uint!(1 0 0 1 0 1 1 1 1 1 1);
823+
pub type U2552 = uint!(0 0 0 1 1 1 1 1 1 0 0 1);
824+
pub type U2067 = uint!(1 1 0 0 1 0 0 0 0 0 0 1);
808825
// ML-DSA sizes
809826
pub type U2420 = uint!(0 0 1 0 1 1 1 0 1 0 0 1);
810827
pub type U3293 = uint!(1 0 1 1 1 0 1 1 0 0 1 1);
@@ -1011,6 +1028,38 @@ mod extra_sizes {
10111028
4080 => U4080,
10121029
}
10131030

1031+
// NTRU-Prime sizes
1032+
impl_array_sizes! {
1033+
653 => U653,
1034+
654 => U654,
1035+
761 => U761,
1036+
762 => U762,
1037+
857 => U857,
1038+
865 => U865,
1039+
858 => U858,
1040+
953 => U953,
1041+
954 => U954,
1042+
994 => U994,
1043+
1007 => U1007,
1044+
1013 => U1013,
1045+
1014 => U1014,
1046+
1158 => U1158,
1047+
1277 => U1277,
1048+
1278 => U1278,
1049+
1305 => U1305,
1050+
1317 => U1317,
1051+
1322 => U1322,
1052+
1423 => U1423,
1053+
1505 => U1505,
1054+
1521 => U1521,
1055+
1623 => U1623,
1056+
1713 => U1713,
1057+
1815 => U1815,
1058+
1905 => U1905,
1059+
2025 => U2025,
1060+
2552 => U2552,
1061+
2067 => U2067,
1062+
}
10141063
// ML-DSA sizes
10151064
impl_array_sizes! {
10161065
2420 => U2420,

0 commit comments

Comments
 (0)