1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
#pike __REAL_VERSION__ 
#pragma strict_types 
 
//! Base class for AE (Authenticated Encryption) algorithms. 
//! 
//! AE algorithms behave like a combination of a @[Cipher] and 
//! a HMAC. 
//! 
//! Note that no actual AE algorithm is implemented 
//! in the base class. They are implemented in classes 
//! that inherit this class. 
//! 
//! @seealso 
//!   @[AEAD] 
 
inherit __builtin.Nettle.Cipher; 
 
//! Returns the size of a hash digest. 
int(0..) digest_size(); 
 
//! This is the context for a single incrementally updated AE cipher. 
//! 
//! Most of the functions here are only prototypes, and need to 
//! be overrided via inherit. 
class State 
{ 
  inherit Cipher::State; 
 
  //! Generates a digest, and resets the hashing contents. 
  //! 
  //! @param length 
  //!   If the length argument is provided, the digest is truncated 
  //!   to the given length. 
  //! 
  //! @returns 
  //!   The digest. 
  string(8bit) digest(int|void length); 
 
  //! Returns the size of a hash digest. 
  int(0..) digest_size() 
  { 
    return global::digest_size(); 
  } 
 
  protected void create() 
  { 
    /* Needed to block the default implementation in __Hash.State. */ 
  } 
} 
 
//! Calling `() will return a @[State] object. 
State `()() { 
  return State(); 
}