Skip to content

Commit cbfc24d

Browse files
name refactoring
1 parent 54d6f9b commit cbfc24d

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ int main() {
105105

106106
## How to use? (Hash with HMAC SHA-256)
107107

108-
All you need to do is call the **"hmacSha256"** function to hash the given text by given secret key with HMAC SHA-256.
108+
All you need to do is call the **"hashWithHMACSHA256"** function to hash the given text by given secret key with HMAC SHA-256.
109109

110110
```cpp
111111
#include "libcpp-crypto.hpp"
@@ -118,7 +118,7 @@ int main() {
118118

119119
const auto key = "mySecretKey";
120120

121-
const auto hashedText = CryptoService::hmacSha256(plainText, key);
121+
const auto hashedText = CryptoService::hashWithHMACSHA256(plainText, key);
122122

123123
std::cout << "Hash: " << hashedText << std::endl;
124124

examples/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ void hash()
252252
std::cout << "Hash: " << hashText << std::endl;
253253
}
254254

255-
void hashByHmacSha256()
255+
void hashWithHMACSHA256()
256256
{
257257
const auto plainText = "This text will be hashed soon";
258258
const auto key = "mySecretKey";
259259

260-
const auto hashText = CryptoService::hmacSha256(plainText, key);
260+
const auto hashText = CryptoService::hashWithHMACSHA256(plainText, key);
261261

262262
std::cout << "Hash: " << hashText << std::endl;
263263
}
@@ -300,7 +300,7 @@ int main()
300300

301301
hash();
302302

303-
hashByHmacSha256();
303+
hashWithHMACSHA256();
304304

305305
return 0;
306306
}

src/libcpp-crypto.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ namespace lklibs
745745
*
746746
* @return Hashed string
747747
*/
748-
inline std::string hmacSha256(const std::string& plainText, const std::string& key)
748+
inline std::string hashWithHMACSHA256(const std::string& plainText, const std::string& key)
749749
{
750750
const auto keyBytes = reinterpret_cast<const unsigned char*>(key.c_str());
751751
const size_t keyLength = key.length();

test/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ TEST(HmacSha256Test, HashWithHMACSHA256MustBeCompletedSuccessfully)
499499
const auto plainText = "This text will be hashed soon";
500500
const auto key = "mySecretKey";
501501

502-
const auto hashText = CryptoService::hmacSha256(plainText, key);
502+
const auto hashText = CryptoService::hashWithHMACSHA256(plainText, key);
503503

504504
ASSERT_EQ(hashText, "875dae56af4cb9c9c1b2e7f30e28704da4f1933bf85bb180409761f9c4721186") << "Hash is invalid";
505505
}

0 commit comments

Comments
 (0)