/[dtapublic]/swprojs/trunk/projs/20120418_blackjacksim/source/bjcceval/vcinfo.c
ViewVC logotype

Contents of /swprojs/trunk/projs/20120418_blackjacksim/source/bjcceval/vcinfo.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations) (download)
Fri Oct 7 03:35:12 2016 UTC (6 years, 3 months ago) by dashley
File MIME type: text/plain
File size: 5534 byte(s)
Commit of Blackjack simulation project.
1 //----------------------------------------------------------------------------------------------------
2 //$Header: /home/dashley/cvsrep/e3ft_gpl01/e3ft_gpl01/dtaipubs/cron/2010/blackjack_201010/source/bjcceval/vcinfo.c,v 1.8 2012/04/11 03:31:51 dashley Exp $
3 //----------------------------------------------------------------------------------------------------
4 //Copyright (C) 2012, David T. Ashley.
5 //
6 //This file is part of BJCCEVAL, a program that evaluates by simulation
7 //the best basic strategy, card-counting, and other playing strategies
8 //for several variants of the game of Blackjack.
9 //
10 //BJCCEVAL is free software: you can redistribute it and/or modify
11 //it under the terms of the GNU General Public License as published by
12 //the Free Software Foundation, either version 3 of the License, or
13 //(at your option) any later version.
14 //
15 //BJCCEVAL is distributed in the hope that it will be useful,
16 //but WITHOUT ANY WARRANTY; without even the implied warranty of
17 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 //GNU General Public License for more details.
19 //
20 //You should have received a copy of the GNU General Public License
21 //along with this program. If not, see <http://www.gnu.org/licenses/>.
22 //(A copy of the GNU General Public License, Version 3 is provided in
23 //the file "COPYING" distributed with BJCCEVAL.)
24 //
25 //David T. Ashley can be contacted at DASHLEY@GMAIL.COM and/or at
26 //P.O. Box 918, Marshall MI 49068.
27 //----------------------------------------------------------------------------------------------------
28 #define MODULE_VCINFO
29
30 #include <malloc.h>
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <string.h>
34
35 #include "c_main.h"
36 #include "cassert.h"
37 #include "charfunc.h"
38 #include "fatal.h"
39 #include "memops.h"
40 #include "mt19937.h"
41 #include "random.h"
42 #include "sha512.h"
43 #include "stdformat.h"
44 #include "timefunc.h"
45 #include "vcinfo.h"
46
47
48 #ifdef P_CASSERT //If assertions enabled, use slightly different salt.
49 #define VCINFO_SALT ("a;dhklhewheifgwobviifweio9182634896123461238934938lsgdfoiasiofdaiosgfihasvdhf314159271983274" __DATE__ __TIME__)
50 #else
51 #define VCINFO_SALT ("a;dhklhewheifgwobviifweio9182634896123461238934938lsgdfoiasiofdaiosgfihasvdhf314159271983274" __DATE__ __TIME__ "beavisandbutthead-startrek-csilasvegas")
52 #endif
53 //The above strings are to add more juice to the SHA1. The date and time ensure compile uniqueness so that any released
54 //executable can be verified to be the same or different than any other released executable. There is no logic to the
55 //strings (and no logic should be necessary given the nature of a cryptographic hash function). These are just semi-random
56 //characters typed on the keyboard.
57
58
59 //Table of all the functions that can be called to get version control information.
60 const char *((*vcfptrs[])(void)) =
61 {
62 C_MAIN_Vcinfo_C,
63 C_MAIN_Vcinfo_H,
64 CASSERT_Vcinfo_C,
65 CASSERT_Vcinfo_H,
66 CHARFUNC_Vcinfo_C,
67 CHARFUNC_Vcinfo_H,
68 FATAL_Vcinfo_C,
69 FATAL_Vcinfo_H,
70 MEMOPS_Vcinfo_C,
71 MEMOPS_Vcinfo_H,
72 MT19937_Vcinfo_C,
73 MT19937_Vcinfo_H,
74 RANDOM_Vcinfo_C,
75 RANDOM_Vcinfo_H,
76 SHA512_Vcinfo_C,
77 SHA512_Vcinfo_H,
78 STDFORMAT_Vcinfo_C,
79 STDFORMAT_Vcinfo_H,
80 TIMEFUNC_Vcinfo_C,
81 TIMEFUNC_Vcinfo_H,
82 VCINFO_Vcinfo_C,
83 VCINFO_Vcinfo_H,
84 };
85
86
87 void VCINFO_signature( VCINFO_SIGNATURE *out_sig )
88 {
89 unsigned i;
90 char *temp;
91 struct SHA512_Sha512StateStruct sha512calcstate;
92 struct SHA512_Sha512ResultStruct sha512result;
93
94 SHA512_Sha512StateStructOpen(&sha512calcstate);
95
96 for (i=0; i<(sizeof(vcfptrs)/sizeof(vcfptrs[0])); i++)
97 {
98 SHA512_Sha512StateStructAddData(&sha512calcstate,
99 VCINFO_SALT,
100 strlen(VCINFO_SALT));
101
102 temp = (char *)((*(vcfptrs[i]))());
103 //printf("\n%s\n", temp);
104 SHA512_Sha512StateStructAddData(&sha512calcstate,
105 temp,
106 strlen(temp));
107 }
108
109 //Final salt.
110 SHA512_Sha512StateStructAddData(&sha512calcstate,
111 VCINFO_SALT,
112 strlen(VCINFO_SALT));
113
114 SHA512_Sha512StateStructClose(&sha512calcstate,
115 &sha512result);
116
117 strcpy_s(out_sig->sig, sizeof(out_sig->sig), sha512result.sha512_chars);
118 }
119
120
121 const char *VCINFO_Vcinfo_C(void)
122 {
123 return("$Revision: 1.8 $");
124 }
125
126
127 const char *VCINFO_Vcinfo_H(void)
128 {
129 return(VCINFO_VCINFO_H);
130 }
131
132
133 //----------------------------------------------------------------------------------------------------
134 //$Log: vcinfo.c,v $
135 //Revision 1.8 2012/04/11 03:31:51 dashley
136 //Edits.
137 //
138 //Revision 1.7 2012/03/30 00:58:36 dashley
139 //Edits.
140 //
141 //Revision 1.6 2012/03/30 00:20:15 dashley
142 //Edits.
143 //
144 //Revision 1.5 2012/03/29 23:44:01 dashley
145 //Edits.
146 //
147 //Revision 1.4 2012/03/29 00:42:06 dashley
148 //Edits.
149 //
150 //Revision 1.3 2012/03/28 23:58:42 dashley
151 //Edits.
152 //
153 //Revision 1.2 2012/03/15 23:38:08 dashley
154 //License text enhanced.
155 //
156 //Revision 1.1 2012/03/14 01:44:01 dashley
157 //Initial checkin.
158 //----------------------------------------------------------------------------------------------------
159 //End of $RCSfile: vcinfo.c,v $
160 //----------------------------------------------------------------------------------------------------

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25