File tree Expand file tree Collapse file tree 1 file changed +9
-17
lines changed
Expand file tree Collapse file tree 1 file changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -48,29 +48,21 @@ cfg_if::cfg_if! {
4848}
4949
5050#[ inline]
51- pub fn biguint_from_words ( words : & [ u32 ] ) -> BigUint {
52- let mut bytes = Vec :: with_capacity ( words . len ( ) * 4 ) ;
53- for word in words {
51+ pub fn biguint_from_be_words ( be_words : & [ u32 ] ) -> BigUint {
52+ let mut bytes = Vec :: with_capacity ( be_words . len ( ) * 4 ) ;
53+ for word in be_words {
5454 bytes. extend_from_slice ( & word. to_le_bytes ( ) ) ;
5555 }
56- BigUint :: from_bytes_le ( & bytes)
56+ BigUint :: from_bytes_be ( & bytes)
5757}
5858
5959#[ inline]
60- pub fn biguint_to_words ( integer : & BigUint , num_words : usize ) -> Vec < u32 > {
61- let mut bytes = integer. to_bytes_le ( ) ;
62- bytes. resize ( num_words * 4 , 0u8 ) ;
63- let mut words = Vec :: with_capacity ( num_words) ;
64- for i in 0 ..num_words {
65- let word = u32:: from_le_bytes ( [
66- bytes[ 4 * i] ,
67- bytes[ 4 * i + 1 ] ,
68- bytes[ 4 * i + 2 ] ,
69- bytes[ 4 * i + 3 ] ,
70- ] ) ;
71- words. push ( word) ;
60+ pub fn biguint_from_le_words ( words : & [ u32 ] ) -> BigUint {
61+ let mut bytes = Vec :: with_capacity ( words. len ( ) * 4 ) ;
62+ for word in words {
63+ bytes. extend_from_slice ( & word. to_le_bytes ( ) ) ;
7264 }
73- words
65+ BigUint :: from_bytes_le ( & bytes )
7466}
7567
7668#[ inline]
You can’t perform that action at this time.
0 commit comments