|
||||
Warning, file /include/nettle/knuth-lfib.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* knuth-lfib.h 0002 0003 The "lagged fibonacci" pseudorandomness generator, described in 0004 Knuth, TAoCP, 3.6 0005 0006 This file is part of GNU Nettle. 0007 0008 GNU Nettle is free software: you can redistribute it and/or 0009 modify it under the terms of either: 0010 0011 * the GNU Lesser General Public License as published by the Free 0012 Software Foundation; either version 3 of the License, or (at your 0013 option) any later version. 0014 0015 or 0016 0017 * the GNU General Public License as published by the Free 0018 Software Foundation; either version 2 of the License, or (at your 0019 option) any later version. 0020 0021 or both in parallel, as here. 0022 0023 GNU Nettle is distributed in the hope that it will be useful, 0024 but WITHOUT ANY WARRANTY; without even the implied warranty of 0025 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0026 General Public License for more details. 0027 0028 You should have received copies of the GNU General Public License and 0029 the GNU Lesser General Public License along with this program. If 0030 not, see http://www.gnu.org/licenses/. 0031 */ 0032 0033 /* NOTE: This generator is totally inappropriate for cryptographic 0034 * applications. It is useful for generating deterministic but 0035 * random-looking test data, and is used by the Nettle testsuite. */ 0036 #ifndef NETTLE_KNUTH_LFIB_H_INCLUDED 0037 #define NETTLE_KNUTH_LFIB_H_INCLUDED 0038 0039 #include "nettle-types.h" 0040 0041 #ifdef __cplusplus 0042 extern "C" { 0043 #endif 0044 0045 /* Namespace mangling */ 0046 #define knuth_lfib_init nettle_knuth_lfib_init 0047 #define knuth_lfib_get nettle_knuth_lfib_get 0048 #define knuth_lfib_get_array nettle_knuth_lfib_get_array 0049 #define knuth_lfib_random nettle_knuth_lfib_random 0050 0051 #define _KNUTH_LFIB_KK 100 0052 0053 struct knuth_lfib_ctx 0054 { 0055 uint32_t x[_KNUTH_LFIB_KK]; 0056 unsigned index; 0057 }; 0058 0059 void 0060 knuth_lfib_init(struct knuth_lfib_ctx *ctx, uint32_t seed); 0061 0062 /* Get's a single number in the range 0 ... 2^30-1 */ 0063 uint32_t 0064 knuth_lfib_get(struct knuth_lfib_ctx *ctx); 0065 0066 /* Get an array of numbers */ 0067 void 0068 knuth_lfib_get_array(struct knuth_lfib_ctx *ctx, 0069 size_t n, uint32_t *a); 0070 0071 /* Get an array of octets. */ 0072 void 0073 knuth_lfib_random(struct knuth_lfib_ctx *ctx, 0074 size_t n, uint8_t *dst); 0075 0076 #ifdef __cplusplus 0077 } 0078 #endif 0079 0080 #endif /* NETTLE_KNUTH_LFIB_H_INCLUDED */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |