From 177a9650c8b493f9fa10b073aed3eec0c36fa6fd Mon Sep 17 00:00:00 2001 From: xx Date: Thu, 13 Mar 2025 17:28:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/module/codec.cpp | 4 ++-- src/module/codec.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/module/codec.cpp b/src/module/codec.cpp index 826cde8..5d237db 100644 --- a/src/module/codec.cpp +++ b/src/module/codec.cpp @@ -50,9 +50,9 @@ std::string module::codec::sha256(const std::string_view& value) { return ylib::codec::sha256(ylib::buffer(value.data(), value.length())).to_hex(); } -std::string module::codec::hmac_sha256(const std::string& key, const std::string_view& value) +std::string module::codec::hmac_sha256(const std::string_view& key, const std::string_view& value) { - return ylib::codec::hmac_sha256(key,ylib::buffer(value.data(), value.length())).to_hex(); + return ylib::codec::hmac_sha256(ylib::buffer(key.data(), key.length()),ylib::buffer(value.data(), value.length())).to_hex(); } void module::codec::regist(sol::state* lua) { diff --git a/src/module/codec.h b/src/module/codec.h index 596ed1c..8092fe8 100644 --- a/src/module/codec.h +++ b/src/module/codec.h @@ -32,7 +32,7 @@ namespace module static std::string sha1(const std::string_view& value); static std::string sha256(const std::string_view& value); - static std::string hmac_sha256(const std::string& key,const std::string_view& value); + static std::string hmac_sha256(const std::string_view& key,const std::string_view& value); static void regist(sol::state* lua); };