MCPcopy Create free account
hub / github.com/apple/foundationdb / genRandomAlphanumStringRef

Function genRandomAlphanumStringRef

fdbrpc/TokenSign.cpp:63–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61constexpr int MaxKeyNameLenPlus1 = 21;
62
63StringRef genRandomAlphanumStringRef(Arena& arena, IRandom& rng, int minLen, int maxLenPlusOne) {
64 const auto len = rng.randomInt(minLen, maxLenPlusOne);
65 auto strRaw = new (arena) uint8_t[len];
66 for (auto i = 0; i < len; i++)
67 strRaw[i] = (uint8_t)rng.randomAlphaNumeric();
68 return StringRef(strRaw, len);
69}
70
71bool checkVerifyAlgorithm(PKeyAlgorithm algo, PublicKey key) {
72 if (algo != key.algorithm()) {

Callers 2

makeRandomTokenSpecFunction · 0.85
TokenSign.cppFile · 0.85

Calls 3

randomAlphaNumericMethod · 0.80
StringRefClass · 0.50
randomIntMethod · 0.45

Tested by

no test coverage detected