4 Star 10 Fork 7

liudengfeng/xfrpc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fastpbkdf2.c 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
// SPDX-License-Identifier: GPL-3.0-only
/*
* Copyright (c) 2023 Dengfeng Liu <liudf0716@gmail.com>
*/
#include <string.h>
#include <assert.h>
#include <openssl/evp.h>
#include <openssl/core_names.h>
#include "fastpbkdf2.h"
void fastpbkdf2_hmac_sha1(const uint8_t *pw, size_t npw,
const uint8_t *salt, size_t nsalt,
uint32_t iterations,
uint8_t *out, size_t nout) {
PKCS5_PBKDF2_HMAC((const char *)pw, npw,
salt, nsalt, iterations,
EVP_sha1(), nout, out);
}
void fastpbkdf2_hmac_sha256(const uint8_t *pw, size_t npw,
const uint8_t *salt, size_t nsalt,
uint32_t iterations,
uint8_t *out, size_t nout) {
PKCS5_PBKDF2_HMAC((const char *)pw, npw,
salt, nsalt, iterations,
EVP_sha256(), nout, out);
}
void fastpbkdf2_hmac_sha512(const uint8_t *pw, size_t npw,
const uint8_t *salt, size_t nsalt,
uint32_t iterations,
uint8_t *out, size_t nout) {
PKCS5_PBKDF2_HMAC((const char *)pw, npw,
salt, nsalt, iterations,
EVP_sha512(), nout, out);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/apfree/xfrpc.git
git@gitee.com:apfree/xfrpc.git
apfree
xfrpc
xfrpc
master

搜索帮助