Changeset 102335 in vbox for trunk/src/VBox/Runtime/common/crypto
- Timestamp:
- Nov 27, 2023 5:01:59 PM (17 months ago)
- svn:sync-xref-src-repo-rev:
- 160471
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/crypto/shacrypt.cpp
r102297 r102335 43 43 #include <iprt/types.h> 44 44 #include <iprt/mem.h> 45 #include <iprt/rand.h> 45 46 #include <iprt/sha.h> 46 47 #include <iprt/string.h> 47 48 49 50 51 RTR3DECL(int) RTCrShaCryptGenerateSalt(char szSalt[RT_SHACRYPT_MAX_SALT_LEN + 1], size_t cchSalt) 52 { 53 AssertMsgReturn(cchSalt >= RT_SHACRYPT_MIN_SALT_LEN && cchSalt <= RT_SHACRYPT_MAX_SALT_LEN, ("len=%zu\n", cchSalt), 54 VERR_INVALID_PARAMETER); 55 56 static const char aRange[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890./"; 57 for (size_t i = 0; i < cchSalt; i++) 58 szSalt[i] = aRange[RTRandU32Ex(0, sizeof(aRange) - 2)]; 59 60 szSalt[RT_SHACRYPT_MAX_SALT_LEN] = '\0'; 61 return VINF_SUCCESS; 62 } 48 63 49 64
Note:
See TracChangeset
for help on using the changeset viewer.