11//! Development-related functionality
22
3- use super :: { ExtendableOutput , Input , Reset , VariableOutput , XofReader } ;
3+ use super :: { ExtendableOutput , Reset , Update , VariableOutput , XofReader } ;
44use core:: fmt:: Debug ;
55
66/// Define test
@@ -41,15 +41,15 @@ mod foo {
4141 {
4242 let mut hasher = D :: new ( ) ;
4343 // Test that it works when accepting the message all at once
44- hasher. input ( input) ;
44+ hasher. update ( input) ;
4545 let mut hasher2 = hasher. clone ( ) ;
4646 if hasher. result ( ) . as_slice ( ) != output {
4747 return Some ( "whole message" ) ;
4848 }
4949
5050 // Test if reset works correctly
5151 hasher2. reset ( ) ;
52- hasher2. input ( input) ;
52+ hasher2. update ( input) ;
5353 if hasher2. result ( ) . as_slice ( ) != output {
5454 return Some ( "whole message after reset" ) ;
5555 }
@@ -60,7 +60,7 @@ mod foo {
6060 let mut left = len;
6161 while left > 0 {
6262 let take = ( left + 1 ) / 2 ;
63- hasher. input ( & input[ len - left..take + len - left] ) ;
63+ hasher. update ( & input[ len - left..take + len - left] ) ;
6464 left -= take;
6565 }
6666 if hasher. result ( ) . as_slice ( ) != output {
@@ -70,7 +70,7 @@ mod foo {
7070 // Test processing byte-by-byte
7171 let mut hasher = D :: new ( ) ;
7272 for chunk in input. chunks ( 1 ) {
73- hasher. input ( chunk)
73+ hasher. update ( chunk)
7474 }
7575 if hasher. result ( ) . as_slice ( ) != output {
7676 return Some ( "message byte-by-byte" ) ;
@@ -85,9 +85,9 @@ mod foo {
8585 {
8686 let mut sh = D :: new ( ) ;
8787 for _ in 0 ..50_000 {
88- sh. input ( & [ b'a' ; 10 ] ) ;
88+ sh. update ( & [ b'a' ; 10 ] ) ;
8989 }
90- sh. input ( & [ b'a' ; 500_000 ] [ ..] ) ;
90+ sh. update ( & [ b'a' ; 500_000 ] [ ..] ) ;
9191 let out = sh. result ( ) ;
9292 assert_eq ! ( out[ ..] , expected[ ..] ) ;
9393 }
@@ -98,12 +98,12 @@ pub use self::foo::{digest_test, one_million_a};
9898/// XOF test
9999pub fn xof_test < D > ( input : & [ u8 ] , output : & [ u8 ] ) -> Option < & ' static str >
100100where
101- D : Input + ExtendableOutput + Default + Debug + Reset + Clone ,
101+ D : Update + ExtendableOutput + Default + Debug + Reset + Clone ,
102102{
103103 let mut hasher = D :: default ( ) ;
104104 let mut buf = [ 0u8 ; 1024 ] ;
105105 // Test that it works when accepting the message all at once
106- hasher. input ( input) ;
106+ hasher. update ( input) ;
107107
108108 let mut hasher2 = hasher. clone ( ) ;
109109 {
@@ -117,7 +117,7 @@ where
117117
118118 // Test if hasher resets correctly
119119 hasher2. reset ( ) ;
120- hasher2. input ( input) ;
120+ hasher2. update ( input) ;
121121
122122 {
123123 let out = & mut buf[ ..output. len ( ) ] ;
@@ -134,7 +134,7 @@ where
134134 let mut left = len;
135135 while left > 0 {
136136 let take = ( left + 1 ) / 2 ;
137- hasher. input ( & input[ len - left..take + len - left] ) ;
137+ hasher. update ( & input[ len - left..take + len - left] ) ;
138138 left -= take;
139139 }
140140
@@ -148,7 +148,7 @@ where
148148
149149 // Test reading from reader byte by byte
150150 let mut hasher = D :: default ( ) ;
151- hasher. input ( input) ;
151+ hasher. update ( input) ;
152152
153153 let mut reader = hasher. xof_result ( ) ;
154154 let out = & mut buf[ ..output. len ( ) ] ;
@@ -165,13 +165,13 @@ where
165165/// Variable-output digest test
166166pub fn variable_test < D > ( input : & [ u8 ] , output : & [ u8 ] ) -> Option < & ' static str >
167167where
168- D : Input + VariableOutput + Reset + Debug + Clone ,
168+ D : Update + VariableOutput + Reset + Debug + Clone ,
169169{
170170 let mut hasher = D :: new ( output. len ( ) ) . unwrap ( ) ;
171171 let mut buf = [ 0u8 ; 128 ] ;
172172 let buf = & mut buf[ ..output. len ( ) ] ;
173173 // Test that it works when accepting the message all at once
174- hasher. input ( input) ;
174+ hasher. update ( input) ;
175175 let mut hasher2 = hasher. clone ( ) ;
176176 hasher. variable_result ( |res| buf. copy_from_slice ( res) ) ;
177177 if buf != output {
@@ -180,7 +180,7 @@ where
180180
181181 // Test if reset works correctly
182182 hasher2. reset ( ) ;
183- hasher2. input ( input) ;
183+ hasher2. update ( input) ;
184184 hasher2. variable_result ( |res| buf. copy_from_slice ( res) ) ;
185185 if buf != output {
186186 return Some ( "whole message after reset" ) ;
@@ -192,7 +192,7 @@ where
192192 let mut left = len;
193193 while left > 0 {
194194 let take = ( left + 1 ) / 2 ;
195- hasher. input ( & input[ len - left..take + len - left] ) ;
195+ hasher. update ( & input[ len - left..take + len - left] ) ;
196196 left -= take;
197197 }
198198 hasher. variable_result ( |res| buf. copy_from_slice ( res) ) ;
@@ -203,7 +203,7 @@ where
203203 // Test processing byte-by-byte
204204 let mut hasher = D :: new ( output. len ( ) ) . unwrap ( ) ;
205205 for chunk in input. chunks ( 1 ) {
206- hasher. input ( chunk)
206+ hasher. update ( chunk)
207207 }
208208 hasher. variable_result ( |res| buf. copy_from_slice ( res) ) ;
209209 if buf != output {
0 commit comments