You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// A MAC algorithm takes in a key and some data, and produces a MAC (message authentication code) that
235
261
/// can be used to verify the integrity of data.
236
262
///
237
-
/// This trait provides one-shot functions [MAC::mac], [MAC::mac_out], and [MAC::verify].
238
-
/// It also provides streaming functions [MAC::do_update], [MAC::do_final], [MAC::do_final_out],
263
+
/// This trait provides one-shot functions [MAC::mac_out] and [MAC::verify].
264
+
/// It also provides streaming functions [MAC::do_update], [MAC::do_final_out],
239
265
/// and [MAC::do_verify_final].
266
+
/// Fixed-size variants that return the MAC value as an array are provided by [MACFixedOutput].
240
267
/// The workflow is that a MAC object is initialized with a key with [MAC::new] -- or [MAC::new_allow_weak_key] if you
241
268
/// need to disable the library's safety mechanism to prevent the use of weak keys -- then data is
242
269
/// processed into one or more calls to [MAC::do_update],
243
-
/// after that the object can either create a MAC with [MAC::do_final] or [MAC::do_final_out] (which are final functions, and so consume the object),
270
+
/// after that the object can either create a MAC with [MACFixedOutput::do_final] or [MAC::do_final_out] (which are final functions, and so consume the object),
244
271
/// or the object can be used to verify a MAC.
245
272
///
246
273
/// For varifying an existing MAC, it is functionally equivalent to use the provided [MAC::verify] and [MAC::do_verify_final]
@@ -282,17 +309,6 @@ pub trait MAC: Sized {
282
309
/// The size of the output in bytes.
283
310
fnoutput_len(&self) -> usize;
284
311
285
-
/// One-shot API that computes a MAC for the provided data.
286
-
/// `data` can be of any length, including zero bytes.
287
-
///
288
-
/// Note about the security strength of the provided key:
289
-
/// If the provided key is tagged at a lower [SecurityStrength] than the instantiated MAC algorithm,
290
-
/// this will fail with an error:
291
-
/// ```text
292
-
/// MACError::KeyMaterialError(KeyMaterialError::SecurityStrength("HMAC::init(): provided key has a lower security strength than the instantiated HMAC")
293
-
/// ```
294
-
fnmac(self,data:&[u8]) -> Vec<u8>;
295
-
296
312
/// One-shot API that computes a MAC for the provided data and writes it into the provided output slice.
297
313
/// `data` can be of any length, including zero bytes.
298
314
///
@@ -321,8 +337,6 @@ pub trait MAC: Sized {
321
337
/// do_update() is intended to be used as part of a streaming interface, and so may by called multiple times.
322
338
fndo_update(&mutself,data:&[u8]);
323
339
324
-
fndo_final(self) -> Vec<u8>;
325
-
326
340
/// Depending on the underlying MAC implementation, NIST may require that the library enforce
327
341
/// a minimum length on the mac output value. See documentation for the underlying implementation
328
342
/// to see conditions under which it throws [MACError::InvalidLength].
0 commit comments