1 /* Copyright (C) 2010-2020 The RetroArch team
3 * ---------------------------------------------------------------------------------------
4 * The following license statement only applies to this file (lrc_hash.h).
5 * ---------------------------------------------------------------------------------------
7 * Permission is hereby granted, free of charge,
8 * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 #ifndef __LIBRETRO_SDK_HASH_H
24 #define __LIBRETRO_SDK_HASH_H
29 #include <compat/msvc.h>
34 #include <retro_inline.h>
36 #include <retro_common_api.h>
44 * @size : Size of @out.
46 * Hashes SHA256 and outputs a human readable string.
48 void sha256_hash(char *out, const uint8_t *in, size_t size);
50 int sha1_calculate(const char *path, char *result);
52 uint32_t djb2_calculate(const char *str);
54 /* Any 32-bit or wider unsigned integer data type will do */
55 typedef unsigned int MD5_u32plus;
59 MD5_u32plus a, b, c, d;
60 unsigned char buffer[64];
61 MD5_u32plus block[16];
65 * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
66 * MD5 Message-Digest Algorithm (RFC 1321).
69 * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
72 * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
74 * This software was written by Alexander Peslyak in 2001. No copyright is
75 * claimed, and the software is hereby placed in the public domain.
76 * In case this attempt to disclaim copyright and place the software in the
77 * public domain is deemed null and void, then the software is
78 * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
79 * general public under the following terms:
81 * Redistribution and use in source and binary forms, with or without
82 * modification, are permitted.
84 * There's ABSOLUTELY NO WARRANTY, express or implied.
86 * See md5.c for more information.
89 void MD5_Init(MD5_CTX *ctx);
90 void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
91 void MD5_Final(unsigned char *result, MD5_CTX *ctx);