[TIPS]大量应用密码学算法源代码上传(更新中)
信息来源:邪恶八进制信息安全团队([url]www.eviloctal.com[/url])本主题里您可以提交回复 但是必须是提交与本主题同类的密码学算法描述代码
[b]否则将被禁言4天[/b] RSANEW BASE64 JAVA描述 BF-SDK
Blowfish Software Development Kit
Version 1.1
(c) 1996 Markus Hahn & Cedric Reinartz
1. Disclaimer
~~~~~~~~~~~~~
This software is "as it is" .
The makers and developers of this package make no representation, warranty,
assurance or inducement, express or implied, as to its adequacy, sufficiency
or freedom from defect of any kind. Neither the makers or developers will
have any liability to any user resulting from the use of it nor are they
responsible for any data loss or computer failure resulting from any inherent
incompatibilities with any other software or hardware.
2. Introduction
~~~~~~~~~~~~~~~
This is the Blowfish System Development Kit.
It provides the basic functions to en-/decrypt data in ECB and CBC mode.
You can directly use it in Turbo/Borland Pascal, TASM/MASM and even
in MS Visual C++. Interfaces for other languages like Fortran or Cobol
are easy to implement.
To learn how Blowfish works, read BFCBCGR.TXT. Unfortunately it's only
in German (too less time), but you should be able to understand the
functionality of the BF-SDK easily by studying the examples in assembly,
Pascal or C++.
If you want to know more about Blowfish, data encryption and security, please
read
"Applied Cryptography, 2nd Edition" by Bruce Schneier
ISBN 0-472-11709-9
Just send an e-mail to Bruce ([email]schneier@counterpane.com[/email]) to get an 15% discount.
To learn how to use the provided sources read PASCAL.TXT for the Turbo-
Pascal part, ASM.TXT for the assembly part and CPPTXT for the C++ part.
We're interested in any feedback! If you have any questions, suggestions or
improvements, please leave us an e-mail.
3. Files in this package
~~~~~~~~~~~~~~~~~~~~~~~~
sourcecode: BFENG386.ASM the engine, the heart of all
BFE_ASM.INC macros to help in writing assembly apps
BLOWFISH.PAS Pascal unit interface
BLOWFISH.H needed for C implementations
CPP_DEMO.CPP demo written in MS Visual C++
ASM_DEMO.ASM demo written in assembly language
PAS_DEMO.PAS demo written in Pascal
precompiled: BFENG386.OBJ object file of the cryptengine
BLOWFISH.TPU Borland Pascal Unit
ASM_DEMO.EXE assembly demo executable
PAS_DEMO.EXE Pascal demo executable
CPP_DEMO.EXE QuickWin demo for Windows 3.x (and above)
documentation: BF-SDK.TXT you're reading this now
BFCBCGR.TXT explanation of Blowfish (german only, sorry)
ASM.TXT explanation on how to use BF-SDK in Assembler
CPP.TXT explanation on how to use BF-SDK in C++
PASCAL.TXT explanation on how to use BF-SDK in Pascal
misc: MAKEALL.BAT batch file which compiles all the precompiled
from the source, except of the MSVC project
FILE_ID.DIZ BBS description
4. Technical Notes
~~~~~~~~~~~~~~~~~~
This software needs at least:
- IBM compatible AT-system with an 80386SX processor or better
- DOS 3.0 or above
achieved speed: 1.8 MB/sec on a Pentium90
2.7 MB/sec on a Pentium133
The actual version (1.1) is designed for 16bit systems, so you
should be able to use it in every - DOS real mode application
- DOS 286 protected mode application
- Windows 3.x application flawlessly.
5. Copyrights
~~~~~~~~~~~~~
Blowfish is a data encryption algorithm which was published in the Dr.Dobb's
Journal magazine, issue #213 on April 1994. It was developed by Bruce Schneier
and is unpatented and placed in the public domain.
In the September issue 1995 of DDJ Blowfish was (after a sponsored contest)
still unbreaked.
The advantages of this encryption algorithm is its design for 32bit CPUs like
the 80386 and above achieving an excellent performance with a maximum
gain of security.
The Blowfish implementation used in this software was done by:
Markus Hahn
Schellingstrasse 13
72622 Nuertingen
Germany
e-mail: [email]hahn@pcmail.rz.fht-esslingen.de[/email]
and
Cedric Reinartz
Schumannstrasse 51
40822 Mettmann
Germany
e-mail: [email]cer@servww4.ww.uni-erlangen.de[/email] (till end of 1996)
6. Distribution and usage limits
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The BF-SDK can be distributed freely if:
- all files are distributed together
- all files are unmodified
- no fee (excluding material and shipping costs) is taken
If you use BF-SDK 1.1 for your own private purpose or if you developed
a program which is totally free and not bundled with a non-free product,
you can do so without paying any money (to us or someone else).
For any other use (especially profit use) you have to contact Markus Hahn
and Cedric Reinartz.
In any case you have to:
- write a program documentation which contains the whole Copyright
statement (part 5) from this text.
- send us (both) a note that you are using it!
7. The real world
~~~~~~~~~~~~~~~~~
The BF-SDK is used in the following products:
* ASPICRYP by Cedric Reinartz, a DOS based TSR which hooks to an
ASPI-Manager and encrypts the data going to a SCSI-device using the
Blowfish algorithm in CBC mode.
You can get it at:
ftp.franken.de
/pub/crypt/misc/ASPICRxx.ZIP
ftp.garbo.uwasa.fi
/pub/crypt/ASPICRxx.ZIP
* Blowfish Advanced 7 (BFA7) by Markus Hahn
a fast, secure and comfortable file encryption utility
for 386+ and DOS. It'll soon be available for Windows 95, too.
You can get it at:
ftp.uni-stuttgart.de
/pub/systems/pc/security/BFA7xx.ZIP
ftp.garbo.uwasa.fi
/pub/crypt/BFA7xx.ZIP
8. The Future
~~~~~~~~~~~~~
It would be nice to have some CFB routines, which allows Blowfish
to work as a stream cipher, encrypting and decrypting single bytes,
although the performance will be decreased to about 12% of the
original one.
If you want to contribute something, send it to Cedric Reinartz
or Markus Hahn.
- end of document - 采用CAST-256位加密的Back Orifice 2000(BO2000)插件 [code]/* compute crc's */
/* crc-16 is based on the polynomial x^16+x^15+x^2+1 */
/* The bits are inserted from least to most significant */
/* crc-ccitt is based on the polynomial x^16+x^12+x^5+1 */
/* The bits are inserted from most to least significant */
/* The prescription for determining the mask to use for a given polynomial
is as follows:
1. Represent the polynomial by a 17-bit number
2. Assume that the most and least significant bits are 1
3. Place the right 16 bits into an integer
4. Bit reverse if serial LSB's are sent first
*/
/* Usage : crcfast [filename] */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define M16 0xA001 /* crc-16 mask */
#define MTT 0x1021 /* crc-ccitt mask */
/* function declarations */
unsigned int updcrc(unsigned int,int);
unsigned int updcrcr(unsigned int,int);
void perr(char *);
/* variables */
char filename[100];
unsigned int crc16,crctt;
int ch;
unsigned long num;
FILE *fp;
unsigned int crc16tab[256] =
{
0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
};
unsigned int crctttab[256] =
{
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
};
/* driver */
main(argc,argv)
int argc; char **argv;
{
if(argc>2) perr("Usage: crcfast [filename]");
if(argc==2) strcpy(filename,argv[1]);
else
{
printf("\nEnter filename: "); gets(filename);
}
if((fp=fopen(filename,"rb"))==NULL) perr("Can't open file");
num=0L; crc16=crctt=0;
while((ch=fgetc(fp))!=EOF)
{
num++;
crc16=updcrcr(crc16,ch);
crctt=updcrc(crctt,ch);
}
fclose(fp);
printf("\nNumber of bytes = %lu\nCRC16 = %04X\nCRCTT = %04X",
num,crc16,crctt);
}
/* update crc */
unsigned int updcrc(crc,c)
unsigned int crc; int c;
{
int tmp;
tmp=(crc>>8)^c;
crc=(crc<<8)^crctttab[tmp];
return crc;
}
/* update crc reverse */
unsigned int updcrcr(crc,c)
unsigned int crc; int c;
{
int tmp;
tmp=crc^c;
crc=(crc>>8)^crc16tab[tmp & 0xff];
return crc;
}
/* error abort */
void perr(s)
char *s;
{
printf("\n%s",s); exit(1);
}[/code] CRC C D3DES This package is a DES-compatible encipherement package which makes it easy
to send and receive secret mail through electronic mailers.
The most interesting products are:
cipher (decipher) - the actual encipherment/decipherment program.
cipher.1 - the nroff compatible manual page for cipher (please read)
atob, btoa - Binary to ASCII converters from compress 4.0 package
cmail - A script to interface above with your mailer
To install:
Edit the Makefile:
Define -DBSD or not as appropriate
Change MANDIR and BINDIR as appropriate
Type "make"
You may get some compiler warnings about & in front of arrays, invalid
pointer combinations and optimization problems. These are OK. The
important thing is too see if the testsuite passes. If it does, the
make will terminate normally.
Type "make install"
You may want to read about the "~|" option to the BSD mailer and compose
"encr" and "decr" scripts.
Send bug reports to "barrett%[email]asgard@boulder.Colorado.EDU[/email]" C-DES DES PACKET 《DES算法的介绍和实现》配套源代码 DES加密算法程序C51 WjcDes2 DESCRIPTION
-----------
WINCRDLL.ZIP is a collection of Windows DLL's, with source code, that
implements the popular strong cryptosystems and a hashing algorithm. This
package is freeware, you can do whatever you like with it as long as you
agree that I (the author) assume absolutely no responsibility for any
consequences. You should also be aware of any local restrictions on the use
of crypto software that may be in effect in your country.
This package implements the following:
DES The well known U.S. standard
IDEA A very strong cipher used in PGP
MD5 A secure hashing algorithm by noted cryptographer, Ron Rivest.
MDC For want of a better name, a cipher based on the strong
cryptographic properties of MD5.
+---------------------------+----------------------------------------------+
| Andy <[email]asb@cs.nott.ac.uk[/email]> | PGP key fingerprint: EC 80 9C 96 54 63 CC 97 |
| finger for PGP key | : FF 7D C5 69 0B 55 23 63 |
+---------------------------+----------------------------------------------+ Diamond加密算法c DES压缩包 内含N多子包 This package contains 2 DOS executables of the ENIGMA program.
The brunigma.exe on this disk wasn't compiled from the C Source
included. I made use of a special (and really not portable)
library included with my compiler.
This is due to the fact that ANSI.SYS wasn't installed on the
Laptop of Prof. Dr. Brunnstein. I decided to compile an
executable that he could use too. Since ANSI.SYS isn't
installed on all Systems, I included this special version in the
package.
There are two disadvantages however:
1. If I had asked somebody to compile it on a Borland
Compiler, it would be far shorter.
(This also applies to enigma4j.exe.)
2. I could't hide the Cursor. It seems to appear always
at the wrong places.
To avoid these disadvantages, just compile the source
as ANSI.SYS Version. On a Borland Compiler
bcc enigma4j.c
should do it.
Andreas G.Lessig, B"onningstedt 14.7.1995
[email]1lessig@rzdspc1.informatik.uni-hamburg.de[/email] ECC压缩包 DSASample GOST加密解密算法前苏联加密标准c ENIGMA3算法.c GOSTDEMO LOKI97 LOKI压缩包 IDEA压缩包 MARS-PDF MARS..... LUCIFER mars压缩包 KARNMD5 MD5 Zip包 MD5 CPP MD5 C NSEA压缩包 RC2压缩包 RC4压缩包 RC5压缩包 RC5REF RC6压缩包 RC6 C.... ------------------------------
Rijndael ANSI C Reference Code
------------------------------
October 24, 2000
Disclaimer
This software package was submitted to the National Institute of Standards and
Technology (NIST) during the Advanced Encryption Standard (AES) development
effort by Joan Daemen and Vincent Rijmen, the developers of the Rijndael algorithm.
This software is distributed in compliance with export regulations (see below), and
it is intended for non-commercial use, only. NIST does not support this software
and does not provide any guarantees or warranties as to its performance, fitness
for any particular application, or validation under the Cryptographic Module
Validation Program (CMVP) <[url]http://csrc.nist.gov/cryptval/>.[/url] NIST does not accept
any liability associated with its use or misuse. This software is provided as-is.
By accepting this software the user agrees to the terms stated herein.
-----------------------
Export Restrictions
Implementations of cryptography are subject to United States Federal
Government export controls. Export controls on commercial encryption products
are administered by the Bureau of Export Administration (BXA)
<[url]http://www.bxa.doc.gov/Encryption/>[/url] in the U.S. Department of Commerce.
Regulations governing exports of encryption are found in the Export
Administration Regulations (EAR), 15 C.F.R. Parts 730-774.
=====================================================================================
Rijndael
Joan Daemen
Reference Implementation (+ KATs and MCTs) v2.0
-----------------------------------------------------------
This archive contains the following files:
Makefile.bcc: makefile for use with Borland compiler.
Makefile.gcc: makefile for use with GCC-based compilers.
Makefile.Visualc: makefile for use with Visual C compiler.
README: This file.
boxes-ref.dat: Tables that are needed by the reference implementation.
The tables implement the S-box and its inverse, and also
some temporary tables needed for multiplying in the finite
field GF(2^8).
rijndael-alg-ref.c:
rijndael-alg-ref.h:
Algorithm implementation.
rijndael-api-ref.c:
rijndael-api-ref.h:
Interface to the C API.
rijndaeltest-ref.c:
Implementation of the KAT and MCT.
table.128:
table.192:
table.256:
Files needed for the KAT (for the Table Known Answer Test).
Instructions for the KAT and MCT software:
1) Compile the C code and put the executable in the same directory as the
table.??? files.
2) Run the executable. It generates all the tables in the NIST format.
3) Compare the generated tables with the original provided tables, e.g.
in Unix, with `diff'.
Changes with respect to v1.0 (= round 1 submission)
---------------------------------------------------
1) Removed the parameter blockLen from makeKey() and cipherInit().
The parameter is still present in the structures keyInstance and
cipherInstance. rc6源代码未优化 已经通过AES认证 Rijndael英文文档 PSC压缩包 经典加解密源码 RSA加密解密算法c++ RSA算法原代码压缩包 RSA C语言描述的一个例子
页:
[1]
2
