Mercurial > dropbear
view examples/ch2-01.c @ 16:09ab3354aa21 libtomcrypt
propagate of e8bea23df30f9f46c647d06db3b223427b4e3604 and b0b6b4a8843b94d9f049cb5ffe0b1ae91ec1bf8b from branch 'au.asn.ucc.matt.ltc-orig' to 'au.asn.ucc.matt.ltc-db'
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 15 Jun 2004 14:27:14 +0000 |
parents | d7da3b1e1540 |
children |
line wrap: on
line source
/* * Name : ch2-01.c * Purpose : Demonstration of reading the RNG * Author : Tom St Denis * * History : v0.81 Initial release */ /* ch2-02-2 */ #include <mycrypt.h> int main(void) { unsigned char buf[16]; unsigned long len; int ix; /* read the RNG */ len = rng_get_bytes(buf, sizeof(buf), NULL); /* verify return */ if (len != sizeof(buf)) { printf("Error: Only read %lu bytes.\n", len); } else { printf("Read %lu bytes\n", len); for (ix = 0; ix < sizeof(buf); ix++) { printf("%02x ", buf[ix]); } printf("\n"); } return EXIT_SUCCESS; } /* ch2-02-2 */