26#if defined (HAVE_CONFIG_H)
48 hash_fcn (str.data (), str.length (), result_buf);
50 std::ostringstream buf;
52 for (
int i = 0; i < result_buf_len; i++)
53 buf << std::hex << std::setw (2) << std::setfill (
'0')
54 << (result_buf[i] & 0xFF);
117hash (
const std::string& hash_type,
const std::string& str)
119 std::string ht = hash_type;
121 std::transform (ht.begin (), ht.end (), ht.begin (), ::toupper);
125 else if (ht ==
"MD4")
127 else if (ht ==
"MD5")
129 else if (ht ==
"SHA1")
131 else if (ht ==
"SHA224")
133 else if (ht ==
"SHA256")
135 else if (ht ==
"SHA384")
137 else if (ht ==
"SHA512")
141 (
"hash function '%s' not supported", hash_type.c_str ());
144OCTAVE_END_NAMESPACE(crypto)
145OCTAVE_END_NAMESPACE(octave)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
int octave_sha1_digest_size(void)
int octave_sha256_digest_size(void)
int octave_sha224_digest_size(void)
void * octave_sha1_buffer_wrapper(const char *buf, size_t len, void *res)
void * octave_sha384_buffer_wrapper(const char *buf, size_t len, void *res)
int octave_sha384_digest_size(void)
int octave_md5_digest_size(void)
void * octave_md5_buffer_wrapper(const char *buf, size_t len, void *res)
int octave_sha512_digest_size(void)
int octave_md4_digest_size(void)
void * octave_sha224_buffer_wrapper(const char *buf, size_t len, void *res)
void * octave_md4_buffer_wrapper(const char *buf, size_t len, void *res)
void * octave_sha256_buffer_wrapper(const char *buf, size_t len, void *res)
void * octave_md2_buffer_wrapper(const char *buf, size_t len, void *res)
void * octave_sha512_buffer_wrapper(const char *buf, size_t len, void *res)
int octave_md2_digest_size(void)
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
std::string hash(hash_fptr hash_fcn, const std::string &str, int result_buf_len)
std::string md2_hash(const std::string &str)
std::string sha256_hash(const std::string &str)
std::string sha512_hash(const std::string &str)
std::string sha384_hash(const std::string &str)
std::string sha224_hash(const std::string &str)
std::string sha1_hash(const std::string &str)
std::string md4_hash(const std::string &str)
std::string md5_hash(const std::string &str)
void *() hash_fptr(const char *buffer, std::size_t len, void *res)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)