Changeset 102292 in vbox for trunk/src/VBox/Runtime/common/crypto
- Timestamp:
- Nov 24, 2023 1:01:41 PM (17 months ago)
- svn:sync-xref-src-repo-rev:
- 160426
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/crypto/shacrypt.cpp
r102289 r102292 47 47 48 48 49 /** 50 * Calculates a SHAcrypt (SHA-256) digest. 51 * 52 * @returns VBox status code. 53 * @param pszKey Key (password) to use. 54 * @param pszSalt Salt to use. 55 * Must be >= RT_SHACRYPT_MIN_SALT_LEN and <= RT_SHACRYPT_MAX_SALT_LEN. 56 * @param cRounds Number of rounds to use. 57 * @param pabHash Where to return the hash on success. 58 * 59 * @note This implements SHA-crypt.txt Version: 0.6 2016-8-31. 60 */ 61 int RTShaCrypt256(const char *pszKey, const char *pszSalt, uint32_t cRounds, uint8_t pabHash[RTSHA256_HASH_SIZE]) 49 50 RTR3DECL(int) RTShaCrypt256(const char *pszKey, const char *pszSalt, uint32_t cRounds, uint8_t pabHash[RTSHA256_HASH_SIZE]) 62 51 { 63 52 AssertPtrReturn(pszKey, VERR_INVALID_POINTER); … … 182 171 } 183 172 184 /** 185 * Returns a SHAcrypt (SHA-256) digest as a printable scheme. 186 * 187 * @returns VBox status code. 188 * @param pabHash SHAcrypt (SHA-256) digest to return printable scheme for. 189 * @param pszSalt Salt to use. Must match the salt used when generating \a pabHash via RTSha256Crypt(). 190 * @param cRounds Number of rounds used for generating \a pabHash. 191 * @param pszString Where to store the printable string on success. 192 * @param cbString Size (in bytes) of \a pszString. 193 * 194 * @note This implements step 22 of SHA-crypt.txt Version: 0.6 2016-8-31. 195 */ 196 int RTShaCrypt256ToString(uint8_t abHash[RTSHA256_HASH_SIZE], const char *pszSalt, uint32_t cRounds, 197 char *pszString, size_t cbString) 173 174 RTR3DECL(int) RTShaCrypt256ToString(uint8_t abHash[RTSHA256_HASH_SIZE], const char *pszSalt, uint32_t cRounds, 175 char *pszString, size_t cbString) 198 176 { 199 177 AssertPtrReturn(pszSalt, VERR_INVALID_POINTER); … … 243 221 } 244 222 245 /** 246 * Calculates a SHAcrypt (SHA-512) digest. 247 * 248 * @returns VBox status code. 249 * @param pszKey Key (password) to use. 250 * @param pszSalt Salt to use. 251 * Must be >= RT_SHACRYPT_MIN_SALT_LEN and <= RT_SHACRYPT_MAX_SALT_LEN. 252 * @param cRounds Number of rounds to use. 253 * @param pabHash Where to return the hash on success. 254 * 255 * @note This implements SHA-crypt.txt Version: 0.6 2016-8-31. 256 */ 257 int RTShaCrypt512(const char *pszKey, const char *pszSalt, uint32_t cRounds, uint8_t pabHash[RTSHA512_HASH_SIZE]) 223 224 RTR3DECL(int) RTShaCrypt512(const char *pszKey, const char *pszSalt, uint32_t cRounds, uint8_t pabHash[RTSHA512_HASH_SIZE]) 258 225 { 259 226 AssertPtrReturn(pszKey, VERR_INVALID_POINTER); … … 378 345 } 379 346 380 /** 381 * Returns a SHAcrypt (SHA-512) digest as a printable scheme. 382 * 383 * @returns VBox status code. 384 * @param pabHash SHAcrypt (SHA-512) digest to return printable scheme for. 385 * @param pszSalt Salt to use. Must match the salt used when generating \a pabHash via RTSha512Crypt(). 386 * @param cRounds Number of rounds used for generating \a pabHash. 387 * @param pszString Where to store the printable string on success. 388 * @param cbString Size (in bytes) of \a pszString. 389 * 390 * @note This implements step 22 of SHA-crypt.txt Version: 0.6 2016-8-31. 391 */ 392 int RTShaCrypt512ToString(uint8_t abHash[RTSHA512_HASH_SIZE], const char *pszSalt, uint32_t cRounds, 393 char *pszString, size_t cbString) 347 348 RTR3DECL(int) RTShaCrypt512ToString(uint8_t abHash[RTSHA512_HASH_SIZE], const char *pszSalt, uint32_t cRounds, 349 char *pszString, size_t cbString) 394 350 { 395 351 AssertPtrReturn(pszSalt, VERR_INVALID_POINTER);
Note:
See TracChangeset
for help on using the changeset viewer.