Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 11, 2016
0 parents commit 66c008e
Show file tree
Hide file tree
Showing 163 changed files with 139,150 additions and 0 deletions.
Binary file added 2154.pdf
Binary file not shown.
Binary file added 9781590595022.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Freeware License, some rights reserved

Copyright (c) 2005 Michael Welschenbach

Permission is hereby granted, free of charge, to anyone obtaining a copy
of this software and associated documentation files (the "Software"),
to work with the Software within the limits of freeware distribution and fair use.
This includes the rights to use, copy, and modify the Software for personal use.
Users are also allowed and encouraged to submit corrections and modifications
to the Software for the benefit of other users.

It is not allowed to reuse, modify, or redistribute the Software for
commercial use in any way, or for a user�s educational materials such as books
or blog articles without prior permission from the copyright holder.

The above copyright notice and this permission notice need to be included
in all copies or substantial portions of the software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#Apress Source Code

This repository accompanies [*Cryptography in C and C++*](http://www.apress.com/9781590595022) by Michael Welschenbach (Apress, 2005).

![Cover image](9781590595022.jpg)

Download the files as a zip using the green button, or clone the repository to your machine using Git.

##Releases

Release v1.0 corresponds to the code in the published book, without corrections or updates.

##Contributions

See the file Contributing.md for more information on how you can contribute to this repository.
14 changes: 14 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributing to Apress Source Code

Copyright for Apress source code belongs to the author(s). However, under fair use you are encouraged to fork and contribute minor corrections and updates for the benefit of the author(s) and other readers.

## How to Contribute

1. Make sure you have a GitHub account.
2. Fork the repository for the relevant book.
3. Create a new branch on which to make your change, e.g.
`git checkout -b my_code_contribution`
4. Commit your change. Include a commit message describing the correction. Please note that if your commit message is not clear, the correction will not be accepted.
5. Submit a pull request.

Thank you for your contribution!
32 changes: 32 additions & 0 deletions flint/lib/dll/dllmain.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* dllmain.c : Defines the entry point for the DLL application. */

#include <windows.h>
#include "flint.h"

BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
int error = 0;
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
error = FLINTInit_l();
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
FLINTExit_l();
}

if (!error)
return TRUE;
else
return FALSE;
}



178 changes: 178 additions & 0 deletions flint/lib/dll/flint.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
LIBRARY flint.dll

EXPORTS
DllMain
add
add_l
and_l
byte2clint_l
chinrem_l
clearbit_l
clint2byte_l
cmp_l
cpy_l
create_l
create_reg_l
dec_l
div_l
equ_l
fbinstr_l
fdecstr_l
fhexstr_l
foctstr_l
free_l
free_reg_l
fswap_l
genprimes
get_reg_l
gcd_l
inc_l
inv_l
invmon_l
iroot_l
issqr_l
jacobi_l
lcm_l
ld_l
madd_l
mequ_l
mexp2_l
mexp5_l
mexp5m_l
mexp_l
mexpk_l
mexpkm_l
mmul_l
mod2_l
mod_l
msqr_l
msub_l
mul_l
mulmon_l
mult
or_l
prime_l
primroot_l
proot_l
purge_l
purge_reg_l
purgeall_reg_l
purged_l
purgeq_l
rand64_l
rand_l
root_l
sadd
seed64_l
set_noofregs_l
setbit_l
setmax_l
shift_l
shl_l
shr_l
sieve_l
smod
sqr
sqr_l
sqrmon_l
ssub
str2clint_l
strlwr_l
strrev_l
strupr_l
sub
sub_l
testbit_l
tolower_l
toupper_l
u2clint_l
uadd_l
ucrand64_l
udiv_l
ul2clint_l
ulrand64_l
ulseed64_l
ultoa_l
umadd_l
umexp_l
umexpm_l
ummul_l
umod_l
umsub_l
umul
umul_l
usrand64_l
usub_l
vcheck_l
version_l
verstr_l
wmexp_l
wmexpm_l
xclint2str_l
xgcd_l
xor_l
twofact_l
nul_l DATA
one_l DATA
two_l DATA
smallprimes DATA

InitRand64_l
InitRandAES_l
SwitchRandAES_l
RandAES_l
PurgeRandAES_l
InitRandRMDSHA1_l
SwitchRandRMDSHA1_l
RandRMDSHA1_l
PurgeRandRMDSHA1_l
InitRandBBS_l
SwitchRandBBS_l
SeedBBS_l
RandBBS_l
bRandBBS_l
sRandBBS_l
lRandBBS_l
PurgeRandBBS_l

InitRand_l
PurgeRand_l
Rand_l
bRand_l
sRand_l
lRand_l
FindPrime_l
FindPrimeGcd_l
FindPrimeMinMaxGcd_l
RandMinMax_l

GetEntropy_l

ripemd128_l
ripeinit128_l
ripehash128_l
ripefinish128_l
ripemd160_l
ripeinit_l
ripehash_l
ripefinish_l

sha1_l
sha1init_l
sha1hash_l
sha1finish_l

sha256_l
sha256init_l
sha256hash_l
sha256finish_l

AESInit_l
AESKeySched_l
AESCrypt_l
AESKeyExpansion_l
AESInvKeyExpansion_l
AESEncBlock_l
AESDecBlock_l
AESPurge_l

Binary file added flint/lib/dll/flint.dll
Binary file not shown.
Binary file added flint/lib/dll/flint.lib
Binary file not shown.
16 changes: 16 additions & 0 deletions flint/lib/dll/makedll.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
REM Generation of a DLL under Microsoft Visual C/C++, providing the C functions
REM of the FLINT/C package. Deployment of the DLL is accomplished by linking
REM the import library flint.lib to an application. The file flint.def contains
REM a list of the exported symbols.

REM On loading the DLL the run time system automatically calls the function
REM DllMain(). This function is responsible for initializing the randomnumber
REM generators and the bank of CLINT registers. Any application is free to
REM initialize the random number generators on their own with any suitable value
REM (in any case this is recommended for security-critical applications).
REM A reinitialization of the bank of registers by an application is without
REM effect, though the application has to free the allocated registers in its
REM own responsibility.

cl -O2 -DFLINT_ASM -I..\..\src -LD -MD -DFLINT_INITRAND ..\..\flint.c ..\..\aes.c ..\..\ripemd.c ..\..\sha1.c ..\..\sha256.c ..\..\random.c ..\..\entropy.c dllmain.c ..\flintavc.lib advapi32.lib flint.def

Binary file added flint/lib/flinta.lib
Binary file not shown.
Binary file added flint/lib/flintavc.lib
Binary file not shown.
Binary file added flint/lib/libflint.a
Binary file not shown.
94 changes: 94 additions & 0 deletions flint/rsa/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
##############################################################################
# #
# Software supplement to the book "Cryptography in C and C++" #
# by Michael Welschenbach #
# #
# makefile for RSA demo #
# #
# Copyright (C) 1998-2005 by Michael Welschenbach #
# Copyright (C) 1998-2005 by Springer-Verlag Berlin, Heidelberg #
# Copyright (C) 2001-2005 by Apress L.P., Berkeley, CA #
# Copyright (C) 2002-2005 by Wydawnictwa MIKOM, Poland #
# Copyright (C) 2002-2005 by PHEI, P.R.China #
# Copyright (C) 2002-2005 by InfoBook, Korea #
# Copyright (C) 2002-2005 by Triumph Publishing, Russia #
# #
# All Rights Reserved #
# #
# The software may be used for noncommercial purposes and may be altered, #
# as long as the following conditions are accepted without any #
# qualification: #
# #
# (1) All changes to the sources must be identified in such a way that the #
# changed software cannot be misinterpreted as the original software. #
# #
# (2) The statements of copyright may not be removed or altered. #
# #
# (3) The following DISCLAIMER is accepted: #
# #
# DISCLAIMER: #
# #
# There is no warranty for the software contained in this distribution, to #
# the extent permitted by applicable law. The copyright holders provide the #
# software `as is' without warranty of any kind, either expressed or #
# implied, including, but not limited to, the implied warranty of fitness #
# for a particular purpose. The entire risk as to the quality and #
# performance of the program is with you. #
# #
# In no event unless required by applicable law or agreed to in writing #
# will the copyright holders, or any of the individual authors named in #
# the source files, be liable to you for damages, including any general, #
# special, incidental or consequential damages arising out of any use of #
# the software or out of inability to use the software (including but not #
# limited to any financial losses, loss of data or data being rendered #
# inaccurate or losses sustained by you or by third parties as a result of #
# a failure of the software to operate with any other programs), even if #
# such holder or other party has been advised of the possibility of such #
# damages. #
# #
##############################################################################

CFLAGS = -c -O2 -Wall -ansi -I../src -o $@

#Parameters for Unix/Linux
STDCPP=stdc++
EXECUTABLE = -o rsademo

#Parameters for DOS, Windows, OS/2
#STDCPP=stdc++
#STDCPP=stdcpp
#EXECUTABLE = -o rsademo.exe


rsademo: rsademo.o rsakey.o flintpp.o flint.o random.o entropy.o aes.o ripemd.o sha1.o randompp.o
gcc $(EXECUTABLE) rsademo.o rsakey.o random.o entropy.o aes.o ripemd.o sha1.o randompp.o flintpp.o flint.o -l$(STDCPP)

rsademo.o: rsademo.cpp
gcc $(CFLAGS) rsademo.cpp

rsakey.o: rsakey.cpp
gcc $(CFLAGS) rsakey.cpp

flintpp.o: ../src/flintpp.cpp
gcc $(CFLAGS) ../src/flintpp.cpp

flint.o: ../src/flint.c
gcc $(CFLAGS) ../src/flint.c

ripemd.o: ../src/ripemd.c
gcc $(CFLAGS) ../src/ripemd.c

randompp.o: ../src/randompp.cpp
gcc $(CFLAGS) ../src/randompp.cpp

random.o: ../src/random.c
gcc $(CFLAGS) ../src/random.c

aes.o: ../src/aes.c
gcc $(CFLAGS) ../src/aes.c

sha1.o: ../src/sha1.c
gcc $(CFLAGS) ../src/sha1.c

entropy.o: ../src/entropy.c
gcc $(CFLAGS) ../src/entropy.c
Loading

0 comments on commit 66c008e

Please sign in to comment.