ChipMaster's trial hacks on C++CMS starting with v1.2.1. Not sure I'll follow on with the v2 since it looks to be breaking and mostly frivolous.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

51 lines
1.2 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
  4. //
  5. // See accompanying file COPYING.TXT file for licensing details.
  6. //
  7. ///////////////////////////////////////////////////////////////////////////////
  8. #ifndef CPPCMS_URANDOM_H
  9. #define CPPCMS_URANDOM_H
  10. #include <cppcms/defs.h>
  11. #include <booster/hold_ptr.h>
  12. #include <booster/noncopyable.h>
  13. namespace cppcms {
  14. ///
  15. /// \brief High entropy random number generator
  16. ///
  17. /// This is cryptographic random number generator that uses /dev/urandom on POSIX platforms
  18. /// and CryptoAPI's CryptGenRandom function under MS Windows
  19. ///
  20. class CPPCMS_API urandom_device : public booster::noncopyable {
  21. public:
  22. ///
  23. /// Create a new random number generator
  24. ///
  25. urandom_device();
  26. ///
  27. /// Destory it
  28. ///
  29. ~urandom_device();
  30. ///
  31. /// Fill a buffer pointer by \a ptr of \a n bytes with random numbers
  32. ///
  33. void generate(void *ptr,unsigned n);
  34. private:
  35. struct _data;
  36. booster::hold_ptr<_data> d;
  37. };
  38. }
  39. #endif