crypto.h File Reference

#include <QByteArray>
#include <QString>

Go to the source code of this file.

Functions

QByteArray crypto_rand_bytes (int len)
quint32 crypto_rand_quint32 (quint32 max)
QString crypto_rand_string (int len)


Function Documentation

QByteArray crypto_rand_bytes ( int  len  ) 

Returns len bytes of pseudorandom data on success, or an empty QByteArray on failure. This function is based on crypto_seed_rng() from Tor's crypto.c. See LICENSE for details on Tor's license.

Returns up to len bytes of pseudorandom data on success, or an empty QByteArray on failure. The caller should verify that the returned QByteArray contains the requested number of bytes. This function is based on crypto_seed_rng() from Tor's crypto.c. See LICENSE for details on Tor's license.

Definition at line 70 of file crypto.cpp.

Referenced by crypto_rand_quint32().

quint32 crypto_rand_quint32 ( quint32  max  ) 

Returns a pseudorandom integer, chosen uniformly from the the values in the range [0, max). This function is based on crypto_rand_int() from Tor's crypto.c. See LICENSE for details on Tor's license.

Definition at line 127 of file crypto.cpp.

References crypto_rand_bytes().

Referenced by crypto_rand_string().

QString crypto_rand_string ( int  len  ) 

Generates a pseudorandom string of length len containing printable ASCII characters from the range '!' (0x21) to '~' (0x7e).

Definition at line 149 of file crypto.cpp.

References crypto_rand_quint32(), and i().

Referenced by TorSettings::randomPassword().


Generated on Wed Nov 26 21:04:20 2008 for Vidalia by  doxygen 1.5.7.1