xx před 1 rokem
rodič
revize
f160f2cf52
2 změnil soubory, kde provedl 3 přidání a 3 odebrání
  1. 2 2
      src/module/codec.cpp
  2. 1 1
      src/module/codec.h

+ 2 - 2
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)
 {

+ 1 - 1
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);
 	};