/* * This file is part of rasdaman community. * * Rasdaman community is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Rasdaman community is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with rasdaman community. If not, see . * * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / rasdaman GmbH. * * For more information please see * or contact Peter Baumann via . / /** * SOURCE: rasmgr_master.hh * * MODULE: rasmgr * CLASS: RandomGenerator * * PURPOSE: * Own "random number generator", used to scramble the authorization file * * COMMENTS: * None * */ #include "rasmgr_users.hh" RandomGenerator::RandomGenerator() { // if somebody want's seed=1 inside it's seed =0, due to table generation way seed=0; fileVersion=-1; } bool RandomGenerator::setFileVersion(long version) { static bool firstCall=true; fileVersion = version; if(version == 2 ) return true; // the actual version if(version == 1 ) { if(firstCall) std::cout<<"Authorization file will be migrated to the new version"<operator()() ) { rasp=false; } } } seed=oldSeed; return rasp; } /* do not change this table by any means and any reason!! We used for scrambling the authorization file the standard rand() function, but we are paranoic that someone could upgrade some system and change the rand function, breaking the decoding of the file To avoid such trouble, we put a table here generated with: srand(1); for(int i=0;i<40;i++) { for(int j=0;j<25;j++) { unsigned char b=rand(); std::cout<<(unsigned int)b<<','; } std::cout<