Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Macros | Functions
sha2init.c File Reference
`#include <ruby/ruby.h>`
`#include "../digest.h"`
`#include "sha2.h"`

Go to the source code of this file.

## Macros
#define | FOREACH_BITLEN(func) func(256) func(384) func(512)
#define | DEFINE_ALGO_METADATA(bitlen)
#define | DECLARE_ALGO_CLASS(bitlen) VALUE cDigest_SHA##bitlen;
#define | DEFINE_ALGO_CLASS(bitlen)
#define | RUBY_UNTYPED_DATA_WARNING 0

## Functions
void | Init_sha2 (void)

## Macro Definition Documentation

## ◆ DECLARE_ALGO_CLASS

#define DECLARE_ALGO_CLASS | ( |  | bitlen | ) | VALUE cDigest_SHA##bitlen;

## ◆ DEFINE_ALGO_CLASS

#define DEFINE_ALGO_CLASS | ( |  | bitlen | ) |

Value:
cDigest_SHA##bitlen = rb_define_class_under(mDigest, "SHA" #bitlen, cDigest_Base); \
\
rb_ivar_set(cDigest_SHA##bitlen, id_metadata, \
Data_Wrap_Struct(0, 0, 0, (void *)&sha##bitlen));

## ◆ DEFINE_ALGO_METADATA

#define DEFINE_ALGO_METADATA | ( |  | bitlen | ) |

Value:
static const rb_digest_metadata_t sha##bitlen = { \
RUBY_DIGEST_API_VERSION, \
SHA##bitlen##_DIGEST_LENGTH, \
SHA##bitlen##_BLOCK_LENGTH, \
sizeof(SHA##bitlen##_CTX), \
(rb_digest_hash_init_func_t)SHA##bitlen##_Init, \
(rb_digest_hash_update_func_t)SHA##bitlen##_Update, \
(rb_digest_hash_finish_func_t)SHA##bitlen##_Finish, \
};

Definition at line 16 of file sha2init.c.

## ◆ FOREACH_BITLEN

#define FOREACH_BITLEN | ( |  | func | ) | func(256) func(384) func(512)

Definition at line 14 of file sha2init.c.

## ◆ RUBY_UNTYPED_DATA_WARNING

#define RUBY_UNTYPED_DATA_WARNING 0

## Function Documentation

## ◆ Init_sha2()

void Init_sha2 | ( | void |  | ) |

Definition at line 35 of file sha2init.c.

rb_digest_hash_finish_func_t
int(* rb_digest_hash_finish_func_t)(void *, unsigned char *)
Definition: digest.h:22
Data_Wrap_Struct
#define Data_Wrap_Struct(klass, mark, free, sval)
Definition: ruby.h:1211
rb_digest_metadata_t
Definition: digest.h:24
rb_digest_hash_init_func_t
int(* rb_digest_hash_init_func_t)(void *)
Definition: digest.h:20
rb_ivar_set
VALUE rb_ivar_set(VALUE, ID, VALUE)
Definition: variable.c:1300
rb_define_class_under
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
Definition: class.c:698
rb_digest_hash_update_func_t
void(* rb_digest_hash_update_func_t)(void *, unsigned char *, size_t)
Definition: digest.h:21