0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1999-2001, 2004, 2005, 2007, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
70e5a7403f0e0a3bd292b8287c5fed5772c15270Automatic Updater/* $Id: lfsr_test.c,v 1.16 2007/06/19 23:46:59 tbox Exp $ */
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * Verify that returned values are reproducable.
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL);
f1b68725503ff3e46001eee5a1751e29a43a09d1Andreas Gustafsson for (i = 0; i < 32; i++) {
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff printf("lfsr1: state[%2d] = %08x\n", i, state[i]);
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL);
f1b68725503ff3e46001eee5a1751e29a43a09d1Andreas Gustafsson for (i = 0; i < 32; i++) {
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence "but new state is %08x\n",
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * Now do the same with skipping.
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL);
f1b68725503ff3e46001eee5a1751e29a43a09d1Andreas Gustafsson for (i = 0; i < 32; i++) {
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff printf("lfsr1: state[%2d] = %08x\n", i, state[i]);
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL);
f1b68725503ff3e46001eee5a1751e29a43a09d1Andreas Gustafsson for (i = 0; i < 32; i++) {
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence "but new state is %08x\n",
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * Try to find the period of the LFSR.
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff * x^16 + x^5 + x^3 + x^2 + 1
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff isc_lfsr_init(&lfsr2, 0, 16, 0x00008016U, 0, NULL, NULL);
f1b68725503ff3e46001eee5a1751e29a43a09d1Andreas Gustafsson for (i = 0; i < 32; i++) {
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff printf("lfsr2: state[%2d] = %08x\n", i, state[i]);
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff isc_lfsr_init(&lfsr2, 0, 16, 0x00008016U, 0, NULL, NULL);
f1b68725503ff3e46001eee5a1751e29a43a09d1Andreas Gustafsson for (i = 0; i < 32; i++) {
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence "but new state is %08x\n",