Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TraversalServer: use C++'s <chrono> and <random> #6157

Closed
wants to merge 2 commits into from

Conversation

ligfx
Copy link
Contributor

@ligfx ligfx commented Nov 1, 2017

Simpler than gettimeofday and reading /dev/urandom, and cross-platform to boot!

@ligfx ligfx force-pushed the traversalserverchronorandom branch 2 times, most recently from 9c6c2d5 to 1894c7c Compare November 1, 2017 23:25
bytesLeft = sizeof(bytes);
}
memcpy(output, bytes + (bytesLeft -= size), size);
static std::independent_bits_engine<std::default_random_engine, sizeof(unsigned char) * 8,

This comment was marked as off-topic.

This comment was marked as off-topic.

bytesLeft = sizeof(bytes);
}
memcpy(output, bytes + (bytesLeft -= size), size);
static std::independent_bits_engine<std::default_random_engine, sizeof(unsigned char) * 8,

This comment was marked as off-topic.

This comment was marked as off-topic.

@ligfx ligfx force-pushed the traversalserverchronorandom branch 2 times, most recently from ee4ec73 to e715501 Compare November 2, 2017 05:36
{
ssize_t rv = read(urandomFd, bytes, sizeof(bytes));
if (rv != sizeof(bytes))
for (; begin != end; ++begin)

This comment was marked as off-topic.

This comment was marked as off-topic.


{
static RandomDeviceSeedSequence s_seed_seq;
static std::independent_bits_engine<std::default_random_engine, sizeof(unsigned char) * 8,

This comment was marked as off-topic.

This comment was marked as off-topic.

@ligfx ligfx force-pushed the traversalserverchronorandom branch from e715501 to 550c05b Compare November 2, 2017 22:14
@ligfx ligfx force-pushed the traversalserverchronorandom branch from 550c05b to 9669705 Compare November 2, 2017 22:25
@Tilka
Copy link
Member

Tilka commented Oct 7, 2018

We use mbed TLS for random number generation now, so that commit is no longer needed.

@leoetlino
Copy link
Member

Rebased PR: #8091

@leoetlino leoetlino closed this May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants