Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Typedefs | Functions
sha2.h File Reference
`#include <sys/types.h>`

Go to the source code of this file.

## Data Structures
struct | _SHA256_CTX
struct | _SHA512_CTX

## Macros
#define | SHA256_BLOCK_LENGTH 64
#define | SHA256_DIGEST_LENGTH 32
#define | SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
#define | SHA384_BLOCK_LENGTH 128
#define | SHA384_DIGEST_LENGTH 48
#define | SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
#define | SHA512_BLOCK_LENGTH 128
#define | SHA512_DIGEST_LENGTH 64
#define | SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)

## Typedefs
typedef unsigned char | uint8_t
typedef unsigned int | uint32_t
typedef unsigned long long | uint64_t
typedef struct _SHA256_CTX | SHA256_CTX
typedef struct _SHA512_CTX | SHA512_CTX
typedef SHA512_CTX | SHA384_CTX

## Functions
int | SHA256_Init (SHA256_CTX *)
void | SHA256_Update (SHA256_CTX *, const uint8_t *, size_t)
int | SHA256_Final (uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX *)
char * | SHA256_End (SHA256_CTX *, char[SHA256_DIGEST_STRING_LENGTH])
char * | SHA256_Data (const uint8_t *, size_t, char[SHA256_DIGEST_STRING_LENGTH])
int | SHA384_Init (SHA384_CTX *)
void | SHA384_Update (SHA384_CTX *, const uint8_t *, size_t)
int | SHA384_Final (uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX *)
char * | SHA384_End (SHA384_CTX *, char[SHA384_DIGEST_STRING_LENGTH])
char * | SHA384_Data (const uint8_t *, size_t, char[SHA384_DIGEST_STRING_LENGTH])
int | SHA512_Init (SHA512_CTX *)
void | SHA512_Update (SHA512_CTX *, const uint8_t *, size_t)
int | SHA512_Final (uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX *)
char * | SHA512_End (SHA512_CTX *, char[SHA512_DIGEST_STRING_LENGTH])
char * | SHA512_Data (const uint8_t *, size_t, char[SHA512_DIGEST_STRING_LENGTH])

## Macro Definition Documentation

## ◆ SHA256_BLOCK_LENGTH

#define SHA256_BLOCK_LENGTH 64

Definition at line 78 of file sha2.h.

## ◆ SHA256_DIGEST_LENGTH

#define SHA256_DIGEST_LENGTH 32

Definition at line 79 of file sha2.h.

## ◆ SHA256_DIGEST_STRING_LENGTH

#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)

Definition at line 80 of file sha2.h.

## ◆ SHA384_BLOCK_LENGTH

#define SHA384_BLOCK_LENGTH 128

Definition at line 81 of file sha2.h.

## ◆ SHA384_DIGEST_LENGTH

#define SHA384_DIGEST_LENGTH 48

Definition at line 82 of file sha2.h.

## ◆ SHA384_DIGEST_STRING_LENGTH

#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)

Definition at line 83 of file sha2.h.

## ◆ SHA512_BLOCK_LENGTH

#define SHA512_BLOCK_LENGTH 128

Definition at line 84 of file sha2.h.

## ◆ SHA512_DIGEST_LENGTH

#define SHA512_DIGEST_LENGTH 64

Definition at line 85 of file sha2.h.

## ◆ SHA512_DIGEST_STRING_LENGTH

#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)

Definition at line 86 of file sha2.h.

## Typedef Documentation

## ◆ SHA256_CTX

typedef struct _SHA256_CTX SHA256_CTX

## ◆ SHA384_CTX

typedef SHA512_CTX SHA384_CTX

Definition at line 133 of file sha2.h.

## ◆ SHA512_CTX

typedef struct _SHA512_CTX SHA512_CTX

## ◆ uint32_t

typedef unsigned int uint32_t

Definition at line 101 of file sha2.h.

## ◆ uint64_t

typedef unsigned long long uint64_t

Definition at line 102 of file sha2.h.

## ◆ uint8_t

typedef unsigned char uint8_t

Definition at line 100 of file sha2.h.

## Function Documentation

## ◆ SHA256_Data()

char* SHA256_Data | ( | const uint8_t * | ,
|  | size_t | ,
|  | char | [SHA256_DIGEST_STRING_LENGTH]
| ) |  |

Definition at line 665 of file sha2.c.

References len, SHA256_End(), SHA256_Init(), and SHA256_Update().

## ◆ SHA256_End()

char* SHA256_End | ( | SHA256_CTX * | ,
|  | char | [SHA256_DIGEST_STRING_LENGTH]
| ) |  |

## ◆ SHA256_Final()

int SHA256_Final | ( | uint8_t | [SHA256_DIGEST_LENGTH],
|  | SHA256_CTX * |
| ) |  |

## ◆ SHA256_Init()

int SHA256_Init | ( | SHA256_CTX * |  | ) |

Definition at line 344 of file sha2.c.

References MEMCPY_BCOPY, and _SHA256_CTX::state.

Referenced by SHA256_Data().

## ◆ SHA256_Update()

void SHA256_Update | ( | SHA256_CTX * | ,
|  | const uint8_t * | ,
|  | size_t |
| ) |  |

Definition at line 529 of file sha2.c.

References assert, _SHA256_CTX::bitcount, _SHA256_CTX::buffer, int, len, MEMCPY_BCOPY, SHA256_BLOCK_LENGTH, and SHA256_Transform().

Referenced by SHA256_Data().

## ◆ SHA384_Data()

char* SHA384_Data | ( | const uint8_t * | ,
|  | size_t | ,
|  | char | [SHA384_DIGEST_STRING_LENGTH]
| ) |  |

Definition at line 1074 of file sha2.c.

References len, SHA384_End(), SHA384_Init(), and SHA384_Update().

## ◆ SHA384_End()

char* SHA384_End | ( | SHA384_CTX * | ,
|  | char | [SHA384_DIGEST_STRING_LENGTH]
| ) |  |

## ◆ SHA384_Final()

int SHA384_Final | ( | uint8_t | [SHA384_DIGEST_LENGTH],
|  | SHA384_CTX * |
| ) |  |

## ◆ SHA384_Init()

int SHA384_Init | ( | SHA384_CTX * |  | ) |

Definition at line 1008 of file sha2.c.

References MEMCPY_BCOPY, and _SHA512_CTX::state.

Referenced by SHA384_Data().

## ◆ SHA384_Update()

void SHA384_Update | ( | SHA384_CTX * | ,
|  | const uint8_t * | ,
|  | size_t |
| ) |  |

Definition at line 1018 of file sha2.c.

References len, and SHA512_Update().

Referenced by SHA384_Data().

## ◆ SHA512_Data()

char* SHA512_Data | ( | const uint8_t * | ,
|  | size_t | ,
|  | char | [SHA512_DIGEST_STRING_LENGTH]
| ) |  |

Definition at line 998 of file sha2.c.

References len, SHA512_End(), SHA512_Init(), and SHA512_Update().

## ◆ SHA512_End()

char* SHA512_End | ( | SHA512_CTX * | ,
|  | char | [SHA512_DIGEST_STRING_LENGTH]
| ) |  |

## ◆ SHA512_Final()

int SHA512_Final | ( | uint8_t | [SHA512_DIGEST_LENGTH],
|  | SHA512_CTX * |
| ) |  |

## ◆ SHA512_Init()

int SHA512_Init | ( | SHA512_CTX * |  | ) |

Definition at line 675 of file sha2.c.

References MEMCPY_BCOPY, and _SHA512_CTX::state.

Referenced by SHA512_Data().

## ◆ SHA512_Update()

void SHA512_Update | ( | SHA512_CTX * | ,
|  | const uint8_t * | ,
|  | size_t |
| ) |  |

Definition at line 854 of file sha2.c.

References ADDINC128, assert, _SHA512_CTX::bitcount, _SHA512_CTX::buffer, int, len, MEMCPY_BCOPY, SHA512_BLOCK_LENGTH, and SHA512_Transform().

Referenced by SHA384_Update(), and SHA512_Data().