Restructure repository to include all source folders

Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 20:17:20 +09:00
parent 5d3cd64a25
commit dd97ddec92
11602 changed files with 1446576 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
/* GLOBAL.H - RSAREF types and constants
*/
/* PROTOTYPES should be set to one if and only if the compiler supports
function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
been defined with C compiler flags.
*/
#ifndef PROTOTYPES
#define PROTOTYPES 1
#endif
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;
/* UINT4 defines a four byte word */
typedef unsigned long int UINT4;
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
returns an empty list.
*/
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif

View File

@@ -0,0 +1,37 @@
/* MD5.H - header file for MD5C.C
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* MD5 context. */
typedef struct {
UINT4 state[4]; /* state (ABCD) */
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
void MD5Init PROTO_LIST ((MD5_CTX *));
void MD5Update PROTO_LIST
((MD5_CTX *, unsigned char *, unsigned int));
void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));

View File

@@ -0,0 +1,337 @@
/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
#include "global.h"
#include "md5.h"
/* Constants for MD5Transform routine.
*/
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
static void Encode PROTO_LIST
((unsigned char *, UINT4 *, unsigned int));
static void Decode PROTO_LIST
((UINT4 *, unsigned char *, unsigned int));
static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/* F, G, H and I are basic MD5 functions.
*/
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))
/* ROTATE_LEFT rotates x left n bits.
*/
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) { \
(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) { \
(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
/* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
void MD5Init (context)
MD5_CTX *context; /* context */
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
}
/* MD5 block update operation. Continues an MD5 message-digest
operation, processing another message block, and updating the
context.
*/
void MD5Update (context, input, inputLen)
MD5_CTX *context; /* context */
unsigned char *input; /* input block */
unsigned int inputLen; /* length of input block */
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((UINT4)inputLen << 3))
< ((UINT4)inputLen << 3))
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);
partLen = 64 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
MD5_memcpy
((POINTER)&context->buffer[index], (POINTER)input, partLen);
MD5Transform (context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform (context->state, &input[i]);
index = 0;
}
else
i = 0;
/* Buffer remaining input */
MD5_memcpy
((POINTER)&context->buffer[index], (POINTER)&input[i],
inputLen-i);
}
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
the message digest and zeroizing the context.
*/
void MD5Final (digest, context)
unsigned char digest[16]; /* message digest */
MD5_CTX *context; /* context */
{
unsigned char bits[8];
unsigned int index, padLen;
/* Save number of bits */
Encode (bits, context->count, 8);
/* Pad out to 56 mod 64.
*/
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
MD5Update (context, PADDING, padLen);
/* Append length (before padding) */
MD5Update (context, bits, 8);
/* Store state in digest */
Encode (digest, context->state, 16);
/* Zeroize sensitive information.
*/
MD5_memset ((POINTER)context, 0, sizeof (*context));
}
/* MD5 basic transformation. Transforms state based on block.
*/
static void MD5Transform (state, block)
UINT4 state[4];
unsigned char block[64];
{
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
Decode (x, block, 64);
/* Round 1 */
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
/* Round 2 */
GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
GG (d, a, b, c, x[10], S22, 0xa2441453); /* 22 */
GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
/* Round 3 */
HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
HH (b, c, d, a, x[ 6], S34, 0xa4881d05); /* 44 */
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
/* Round 4 */
II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
/* Zeroize sensitive information.
*/
MD5_memset ((POINTER)x, 0, sizeof (x));
}
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
a multiple of 4.
*/
static void Encode (output, input, len)
unsigned char *output;
UINT4 *input;
unsigned int len;
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char)(input[i] & 0xff);
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
}
}
/* Decodes input (unsigned char) into output (UINT4). Assumes len is
a multiple of 4.
*/
static void Decode (output, input, len)
UINT4 *output;
unsigned char *input;
unsigned int len;
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}
/* Note: Replace "for loop" with standard memcpy if possible.
*/
static void MD5_memcpy (output, input, len)
POINTER output;
POINTER input;
unsigned int len;
{
unsigned int i;
for (i = 0; i < len; i++)
output[i] = input[i];
}
/* Note: Replace "for loop" with standard memset if possible.
*/
static void MD5_memset (output, value, len)
POINTER output;
int value;
unsigned int len;
{
unsigned int i;
for (i = 0; i < len; i++)
((char *)output)[i] = (char)value;
}

View File

@@ -0,0 +1,65 @@
// mtrand.cpp, see include file mtrand.h for information
#include "../stdafx.h"
#include "PseudoRandom.h"
#include <time.h>
// non-inline function definitions and static member definitions cannot
// reside in header file because of the risk of multiple declarations
// initialization of static private members
/*unsigned long MersenneTwister::state[Constant1] = {0x0UL};
int MersenneTwister::position = 0;*/
namespace Math
{
MersenneTwister::MersenneTwister(BOOL useCurrentTime) {
if ( useCurrentTime) {
time_t t; time(&t);
SetSeed(unsigned long(t));
} else {
SetSeed(5489UL);
}
}
void MersenneTwister::GenerateState() { // generate new state vector
for (int i = 0; i < (Constant1 - Constant2); ++i)
state[i] = state[i + Constant2] ^ Twiddle(state[i], state[i + 1]);
for (int i = Constant1 - Constant2; i < (Constant1 - 1); ++i)
state[i] = state[i + Constant2 - Constant1] ^ Twiddle(state[i], state[i + 1]);
state[Constant1 - 1] = state[Constant2 - 1] ^ Twiddle(state[Constant1 - 1], state[0]);
position = 0; // reset position
}
void MersenneTwister::SetSeed(unsigned long s) { // initialized by 32 bit seed
for ( int i=0; i<Constant1; ++i) { state[i]= 0x0UL; }
//state[Constant1] = {0x0UL};
state[0] = s & 0xFFFFFFFFUL; // for > 32 bit machines
for (int i = 1; i < Constant1; ++i) {
state[i] = 1812433253UL * (state[i - 1] ^ (state[i - 1] >> 30)) + i;
// see Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier
// in the previous versions, MSBs of the seed affect only MSBs of the array state
// 2002/01/09 modified by Makoto Matsumoto
state[i] &= 0xFFFFFFFFUL; // for > 32 bit machines
}
position = Constant1; // force GenerateState() to be called for next random number
}
void MersenneTwister::SetSeed(const unsigned long* array, int size) { // initialized by array
SetSeed(19650218UL);
int i = 1, j = 0;
for (int k = ((Constant1 > size) ? Constant1 : size); k; --k) {
state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1664525UL))
+ array[j] + j; // non linear
state[i] &= 0xFFFFFFFFUL; // for > 32 bit machines
++j; j %= size;
if ((++i) == Constant1) { state[0] = state[Constant1 - 1]; i = 1; }
}
for (int k = Constant1 - 1; k; --k) {
state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1566083941UL)) - i;
state[i] &= 0xFFFFFFFFUL; // for > 32 bit machines
if ((++i) == Constant1) { state[0] = state[Constant1 - 1]; i = 1; }
}
state[0] = 0x80000000UL; // MSB is 1; assuring non-zero initial array
position = Constant1; // force GenerateState() to be called for next random number
}
}

View File

@@ -0,0 +1,224 @@
#pragma once
namespace Math
{
/**
The Mersenne Twister random number generator
usage:
PseudoRandomInt foo; //initializes random sequence by the current time
PseudoRandomInt foo(false); // the default seed 5489UL is used
foo.SetSeed(230194019);
foo.Next()
foo.Next(10,4300); //returns unsigned long between 10 and 4300
PseudoRandomFloat foo;
foo.Next(); // return double between [0..1)
foo.Next(245); // return double between [0..245)
PseudoRandomFloatClosed foo;
foo.Next(); // return double between [0..1]
PseudoRandomFloatOpen foo;
foo.Next(); // return double between (0..1)
details:
The Mersenne twister is a pseudorandom number generator that was developed in 1997 by Makoto Matsumoto
(áæÜâ òØ) and Takuji Nishimura (à¤õ½ ô¬ÞÍ). It provides for fast generation of very high quality random
numbers - having been designed specifically to rectify many of the flaws found in older algorithms.
It has the following desirable properties:
It was designed to have a colossal period of 219937-1 (the creators of the algorithm proved this property).
It has a very high order of dimensional equidistribution (see linear congruential generator). Note that this means, by default, that there is negligible serial correlation between successive values in the output sequence.
It is faster than all but the most statistically unsound generators.
It is statistically random in all the bits of its output.
This implementation is based C++ code by Takuji Nishimura and Makoto Matsumoto, Jasper Bedaux, Isaku Wada
*/
class MersenneTwister {
public:
// default constructor: uses default seed only if this is the first instance
MersenneTwister(BOOL useCurrentTime=TRUE);
// constructor with 32 bit int as seed
MersenneTwister(unsigned long s) { SetSeed(s); }
// constructor with array of size 32 bit ints as seed
MersenneTwister(const unsigned long* array, int size) { SetSeed(array, size); }
// the two seed functions
void SetSeed(unsigned long); // seed with 32 bit integer
void SetSeed(const unsigned long*, int size); // seed with array
// overload operator() to make this a generator (functor)
//unsigned long operator()() { return GenerateRandom(); }
//unsigned long Next() { return (*this)(); }
~MersenneTwister() {} // destructor
protected: // used by derived classes, otherwise not accessible; use the ()-operator
unsigned long GenerateRandom() { // generate 32 bit random integer
if (position == Constant1) GenerateState(); // new state vector needed
// GenerateState() is split off to be non-inline, because it is only called once
// in every 624 calls and otherwise irand() would become too big to get inlined
unsigned long x = state[position++];
x ^= (x >> 11);
x ^= (x << 7) & 0x9D2C5680UL;
x ^= (x << 15) & 0xEFC60000UL;
return x ^ (x >> 18);
}
private:
enum { Constant1 = 624, Constant2 = 397 };
unsigned long state[Constant1]; // state vector array
int position; // position in state array
// private functions used to generate the pseudo random numbers
unsigned long Twiddle(unsigned long u, unsigned long v) {
return (((u & 0x80000000UL) | (v & 0x7FFFFFFFUL)) >> 1) ^ ((v & 1UL) ? 0x9908B0DFUL : 0x0UL);
} // used by GenerateState()
void GenerateState(); // generate new state
// make copy constructor and assignment operator unavailable, they don't make sense
MersenneTwister(const MersenneTwister&); // copy constructor not defined
void operator=(const MersenneTwister&); // assignment operator not defined
};
class PseudoRandomInt : public MersenneTwister {
public:
PseudoRandomInt(BOOL useCurrentTime=TRUE): MersenneTwister(useCurrentTime) {}
PseudoRandomInt(unsigned long seed) : MersenneTwister(seed) {}
PseudoRandomInt(const unsigned long* seed, int size) : MersenneTwister(seed, size) {}
unsigned long operator()() { return GenerateRandom(); }
unsigned long Next() { return (*this)(); }
unsigned long Next(unsigned long minval, unsigned long maxval) {
return minval+(Next()%(maxval-minval));
}
};
// generates double floating point numbers in the half-open interval [0, 1)
class PseudoRandomFloat : public MersenneTwister {
public:
PseudoRandomFloat(BOOL useCurrentTime=TRUE) : MersenneTwister(useCurrentTime) {}
PseudoRandomFloat(unsigned long seed) : MersenneTwister(seed) {}
PseudoRandomFloat(const unsigned long* seed, int size) : MersenneTwister(seed, size) {}
~PseudoRandomFloat() {}
double operator()() {
return static_cast<double>(GenerateRandom()) * (1. / 4294967296.); } // divided by 2^32
double Next() { return (*this)(); }
double Next(double mul) { return Next()*mul; }
private:
PseudoRandomFloat(const PseudoRandomFloat&); // copy constructor not defined
void operator=(const PseudoRandomFloat&); // assignment operator not defined
};
// generates double floating point numbers in the closed interval [0, 1]
class PseudoRandomFloatClosed : public MersenneTwister {
public:
PseudoRandomFloatClosed(BOOL useCurrentTime=TRUE) : MersenneTwister(useCurrentTime) {}
PseudoRandomFloatClosed(unsigned long seed) : MersenneTwister(seed) {}
PseudoRandomFloatClosed(const unsigned long* seed, int size) : MersenneTwister(seed, size) {}
~PseudoRandomFloatClosed() {}
double operator()() {
return static_cast<double>(GenerateRandom()) * (1. / 4294967295.); } // divided by 2^32 - 1
double Next() { return (*this)(); }
double Next(double mul) { return Next()*mul; }
private:
PseudoRandomFloatClosed(const PseudoRandomFloatClosed&); // copy constructor not defined
void operator=(const PseudoRandomFloatClosed&); // assignment operator not defined
};
// generates double floating point numbers in the open interval (0, 1)
class PseudoRandomFloatOpen : public MersenneTwister {
public:
PseudoRandomFloatOpen(BOOL useCurrentTime=TRUE) : MersenneTwister(useCurrentTime) {}
PseudoRandomFloatOpen(unsigned long seed) : MersenneTwister(seed) {}
PseudoRandomFloatOpen(const unsigned long* seed, int size) : MersenneTwister(seed, size) {}
~PseudoRandomFloatOpen() {}
double operator()() {
return (static_cast<double>(GenerateRandom()) + .5) * (1. / 4294967296.); } // divided by 2^32
double Next() { return (*this)(); }
double Next(double mul) { return Next()*mul; }
private:
PseudoRandomFloatOpen(const PseudoRandomFloatOpen&); // copy constructor not defined
void operator=(const PseudoRandomFloatOpen&); // assignment operator not defined
};
// generates 53 bit resolution doubles in the half-open interval [0, 1)
class PseudoRandomFloat53Bit : public MersenneTwister {
public:
PseudoRandomFloat53Bit(BOOL useCurrentTime=TRUE) : MersenneTwister(useCurrentTime) {}
PseudoRandomFloat53Bit(unsigned long seed) : MersenneTwister(seed) {}
PseudoRandomFloat53Bit(const unsigned long* seed, int size) : MersenneTwister(seed, size) {}
~PseudoRandomFloat53Bit() {}
double operator()() {
return (static_cast<double>(GenerateRandom() >> 5) * 67108864. +
static_cast<double>(GenerateRandom() >> 6)) * (1. / 9007199254740992.); }
double Next() { return (*this)(); }
double Next(double mul) { return Next()*mul; }
private:
PseudoRandomFloat53Bit(const PseudoRandomFloat53Bit&); // copy constructor not defined
void operator=(const PseudoRandomFloat53Bit&); // assignment operator not defined
};
// typedef MersenneTwister PseudoRandom;
// Pseudorandom series(21301391);
// mtrand.h
// C++ include file for MT19937, with initialization improved 2002/1/26.
// Coded by Takuji Nishimura and Makoto Matsumoto.
// Ported to C++ by Jasper Bedaux 2003/1/1 (see http://www.bedaux.net/mtrand/).
// The generators returning floating point numbers are based on
// a version by Isaku Wada, 2002/01/09
//
// Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The names of its contributors may not be used to endorse or promote
// products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Any feedback is very welcome.
// http://www.math.keio.ac.jp/matumoto/emt.html
// email: matumoto@math.keio.ac.jp
//
// Feedback about the C++ port should be sent to Jasper Bedaux,
// see http://www.bedaux.net/mtrand/ for e-mail address and info.
}

View File

@@ -0,0 +1,63 @@
#include "../stdafx.h"
#include "Random.h"
namespace Math
{
RandomInt::RandomInt()
{
SetSeed(GetTickCount());
}
RandomInt::RandomInt(unsigned long seed) : random(seed)
{
}
void RandomInt::SetSeed(unsigned long seed)
{
random.SetSeed(seed);
}
unsigned int RandomInt::Next()
{
return random.Next();
}
unsigned int RandomInt::Next(unsigned int excludedMax)
{
if(excludedMax == 0)
return excludedMax;
return Next(0, excludedMax);
}
unsigned int RandomInt::Next(unsigned int includedMin, unsigned int excludedMax)
{
if(includedMin == excludedMax)
return includedMin;
return random.Next(includedMin, excludedMax);
}
RandomDouble::RandomDouble()
{
SetSeed(GetTickCount());
}
RandomDouble::RandomDouble(unsigned long seed) : random(seed)
{
}
void RandomDouble::SetSeed(unsigned long seed)
{
random.SetSeed(seed);
}
double RandomDouble::Next()
{
return random.Next();
}
}

View File

@@ -0,0 +1,45 @@
#pragma once
#include "PseudoRandom.h"
namespace Math
{
class RandomInt
{
private:
PseudoRandomInt random;
// unable to copy
RandomInt(const RandomInt& );
void operator =(const RandomInt&);
public:
RandomInt();
RandomInt(unsigned long seed);
void SetSeed(unsigned long seed);
virtual unsigned int Next();
virtual unsigned int Next(unsigned int excludedMax);
virtual unsigned int Next(unsigned int includedMin, unsigned int excludedMax);
};
class RandomDouble
{
private:
PseudoRandomFloatClosed random;
// unable to copy
RandomDouble(const RandomDouble& );
void operator =(const RandomDouble&);
public:
RandomDouble();
RandomDouble(unsigned long seed);
void SetSeed(unsigned long seed);
virtual double Next(); // generates a float number [0, 1]
};
}

Binary file not shown.

View File

@@ -0,0 +1,70 @@
// PasswordGenerator.cpp : 응용 프로그램에 대한 클래스 동작을 정의합니다.
//
#include "stdafx.h"
#include "PasswordGenerator.h"
#include "PasswordGeneratorDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CPasswordGeneratorApp
BEGIN_MESSAGE_MAP(CPasswordGeneratorApp, CWinApp)
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
// CPasswordGeneratorApp 생성
CPasswordGeneratorApp::CPasswordGeneratorApp()
{
// TODO: 여기에 생성 코드를 추가합니다.
// InitInstance에 모든 중요한 초기화 작업을 배치합니다.
}
// 유일한 CPasswordGeneratorApp 개체입니다.
CPasswordGeneratorApp theApp;
// CPasswordGeneratorApp 초기화
BOOL CPasswordGeneratorApp::InitInstance()
{
// 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을
// 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControls()가 필요합니다.
// InitCommonControls()를 사용하지 않으면 창을 만들 수 없습니다.
InitCommonControls();
CWinApp::InitInstance();
// 표준 초기화
// 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면
// 아래에서 필요 없는 특정 초기화 루틴을 제거해야 합니다.
// 해당 설정이 저장된 레지스트리 키를 변경하십시오.
// TODO: 이 문자열을 회사 또는 조직의 이름과 같은
// 적절한 내용으로 수정해야 합니다.
SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성한 응용 프로그램"));
CPasswordGeneratorDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 여기에 대화 상자가 확인을 눌러 없어지는 경우 처리할
// 코드를 배치합니다.
}
else if (nResponse == IDCANCEL)
{
// TODO: 여기에 대화 상자가 취소를 눌러 없어지는 경우 처리할
// 코드를 배치합니다.
}
// 대화 상자가 닫혔으므로 응용 프로그램의 메시지 펌프를 시작하지 않고
// 응용 프로그램을 끝낼 수 있도록 FALSE를 반환합니다.
return FALSE;
}

View File

@@ -0,0 +1,31 @@
// PasswordGenerator.h : PROJECT_NAME 응용 프로그램에 대한 주 헤더 파일입니다.
//
#pragma once
#ifndef __AFXWIN_H__
#error PCH에서 이 파일을 포함하기 전에 'stdafx.h'를 포함하십시오.
#endif
#include "resource.h" // 주 기호
// CPasswordGeneratorApp:
// 이 클래스의 구현에 대해서는 PasswordGenerator.cpp을 참조하십시오.
//
class CPasswordGeneratorApp : public CWinApp
{
public:
CPasswordGeneratorApp();
// 재정의
public:
virtual BOOL InitInstance();
// 구현
DECLARE_MESSAGE_MAP()
};
extern CPasswordGeneratorApp theApp;

View File

@@ -0,0 +1,207 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// 한국어 resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
#ifdef _WIN32
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
#pragma code_page(949)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)\r\n"
"LANGUAGE 18, 1\r\n"
"#pragma code_page(949)\r\n"
"#include ""res\\PasswordGenerator.rc2"" // Microsoft Visual C++에서 편집되지 않은 리소스\r\n"
"#include ""afxres.rc"" // 표준 구성 요소\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON "res\\PasswordGenerator.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "PasswordGenerator 정보"
FONT 9, "MS Shell Dlg", 0, 0, 0x1
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "PasswordGenerator Version 1.0",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2009",IDC_STATIC,40,25,119,8
DEFPUSHBUTTON "확인",IDOK,178,7,50,16,WS_GROUP
END
IDD_PASSWORDGENERATOR_DIALOG DIALOGEX 0, 0, 231, 115
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "PasswordGenerator"
FONT 9, "MS Shell Dlg", 0, 0, 0x1
BEGIN
EDITTEXT IDC_EDIT1,56,7,74,14,ES_AUTOHSCROLL | ES_NUMBER
RTEXT "PasswordSize : ",IDC_STATIC,7,10,49,8
EDITTEXT IDC_EDIT2,7,42,217,47,ES_MULTILINE | ES_AUTOHSCROLL |
ES_READONLY
PUSHBUTTON "Generator",IDC_BUTTON1,7,90,217,18,0,WS_EX_STATICEDGE
CONTROL "Use Special Char ",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,137,9,82,10
EDITTEXT IDC_EDIT3,56,24,92,14,ES_AUTOHSCROLL
RTEXT "String :",IDC_STATIC,6,27,47,8
PUSHBUTTON "Convert",IDC_BUTTON2,151,24,73,14,0,WS_EX_CLIENTEDGE
END
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "041203b5"
BEGIN
VALUE "CompanyName", "TODO: <회사 이름>"
VALUE "FileDescription", "TODO: <파일 설명>"
VALUE "FileVersion", "1.0.0.1"
VALUE "InternalName", "PasswordGenerator.exe"
VALUE "LegalCopyright", "TODO: (c) <회사 이름>. All rights reserved."
VALUE "OriginalFilename", "PasswordGenerator.exe"
VALUE "ProductName", "TODO: <제품 이름>"
VALUE "ProductVersion", "1.0.0.1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "변환", 0x412, 949
END
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_PASSWORDGENERATOR_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 224
TOPMARGIN, 7
BOTTOMMARGIN, 108
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_ABOUTBOX "PasswordGenerator 정보(&A)..."
END
#endif // 한국어 resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
LANGUAGE 18, 1
#pragma code_page(949)
#include "res\PasswordGenerator.rc2" // Microsoft Visual C++에서 편집되지 않은 리소스
#include "afxres.rc" // 표준 구성 요소
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PasswordGenerator", "PasswordGenerator.vcproj", "{2FEB1EA1-586F-4530-A481-AC715947010B}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{2FEB1EA1-586F-4530-A481-AC715947010B}.Debug.ActiveCfg = Debug|Win32
{2FEB1EA1-586F-4530-A481-AC715947010B}.Debug.Build.0 = Debug|Win32
{2FEB1EA1-586F-4530-A481-AC715947010B}.Release.ActiveCfg = Release|Win32
{2FEB1EA1-586F-4530-A481-AC715947010B}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -0,0 +1,221 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="PasswordGenerator"
ProjectGUID="{2FEB1EA1-586F-4530-A481-AC715947010B}"
Keyword="MFCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
UseOfMFC="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
TreatWChar_tAsBuiltInType="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="FALSE"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1042"
AdditionalIncludeDirectories="$(IntDir)"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
UseOfMFC="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
MinimalRebuild="FALSE"
RuntimeLibrary="0"
TreatWChar_tAsBuiltInType="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="FALSE"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1042"
AdditionalIncludeDirectories="$(IntDir)"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="소스 파일"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\PasswordGenerator.cpp">
</File>
<File
RelativePath=".\PasswordGeneratorDlg.cpp">
</File>
<File
RelativePath=".\stdafx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="헤더 파일"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\PasswordGenerator.h">
</File>
<File
RelativePath=".\PasswordGeneratorDlg.h">
</File>
<File
RelativePath=".\Resource.h">
</File>
<File
RelativePath=".\stdafx.h">
</File>
</Filter>
<Filter
Name="리소스 파일"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
<File
RelativePath=".\res\PasswordGenerator.ico">
</File>
<File
RelativePath=".\PasswordGenerator.rc">
</File>
<File
RelativePath=".\res\PasswordGenerator.rc2">
</File>
</Filter>
<Filter
Name="MD5"
Filter="">
<File
RelativePath=".\Md5\global.h">
</File>
<File
RelativePath=".\Md5\md5.h">
</File>
<File
RelativePath=".\Md5\md5c.c">
</File>
</Filter>
<Filter
Name="Math"
Filter="">
<File
RelativePath=".\Math\PseudoRandom.cpp">
</File>
<File
RelativePath=".\Math\PseudoRandom.h">
</File>
<File
RelativePath=".\Math\Random.cpp">
</File>
<File
RelativePath=".\Math\Random.h">
</File>
</Filter>
<File
RelativePath=".\res\PasswordGenerator.manifest">
</File>
<File
RelativePath=".\ReadMe.txt">
</File>
</Files>
<Globals>
<Global
Name="RESOURCE_FILE"
Value="PasswordGenerator.rc"/>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,260 @@
// PasswordGeneratorDlg.cpp : 구현 파일
//
#include "stdafx.h"
#include "PasswordGenerator.h"
#include "PasswordGeneratorDlg.h"
#include ".\passwordgeneratordlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
extern "C"
{
#include "MD5/global.h"
#include "MD5/md5.h"
}
#include "Math/Random.h"
// 응용 프로그램 정보에 사용되는 CAboutDlg 대화 상자입니다.
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// 대화 상자 데이터
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원
// 구현
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
// CPasswordGeneratorDlg 대화 상자
CPasswordGeneratorDlg::CPasswordGeneratorDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPasswordGeneratorDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CPasswordGeneratorDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_EDIT2, m_Output);
DDX_Control(pDX, IDC_EDIT1, m_PasswordSize);
DDX_Control(pDX, IDC_CHECK1, m_SpecialChar);
DDX_Control(pDX, IDC_EDIT3, m_InputCode);
}
BEGIN_MESSAGE_MAP(CPasswordGeneratorDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
END_MESSAGE_MAP()
// CPasswordGeneratorDlg 메시지 처리기
BOOL CPasswordGeneratorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 시스템 메뉴에 "정보..." 메뉴 항목을 추가합니다.
// IDM_ABOUTBOX는 시스템 명령 범위에 있어야 합니다.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 이 대화 상자의 아이콘을 설정합니다. 응용 프로그램의 주 창이 대화 상자가 아닐 경우에는
// 프레임워크가 이 작업을 자동으로 수행합니다.
SetIcon(m_hIcon, TRUE); // 큰 아이콘을 설정합니다.
SetIcon(m_hIcon, FALSE); // 작은 아이콘을 설정합니다.
// TODO: 여기에 추가 초기화 작업을 추가합니다.
return TRUE; // 컨트롤에 대한 포커스를 설정하지 않을 경우 TRUE를 반환합니다.
}
void CPasswordGeneratorDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// 대화 상자에 최소화 단추를 추가할 경우 아이콘을 그리려면
// 아래 코드가 필요합니다. 문서/뷰 모델을 사용하는 MFC 응용 프로그램의 경우에는
// 프레임워크에서 이 작업을 자동으로 수행합니다.
void CPasswordGeneratorDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 그리기를 위한 디바이스 컨텍스트
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 클라이언트 사각형에서 아이콘을 가운데에 맞춥니다.
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 아이콘을 그립니다.
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// 사용자가 최소화된 창을 끄는 동안에 커서가 표시되도록 시스템에서
// 이 함수를 호출합니다.
HCURSOR CPasswordGeneratorDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CPasswordGeneratorDlg::OnBnClickedButton1()
{
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
char strTemp[512];
int iSize = 0;
m_PasswordSize.GetWindowText(strTemp, 512);
iSize = atoi(strTemp);
if(iSize < 4 || iSize > 32)
{
AfxMessageBox("4자 이상 32자 이하 여야합니다.", MB_OK);
return;
}
char szPassword[512];
char szPasswordMD5[512];
char szKeyTable[512];
ZeroMemory(szKeyTable, sizeof(szKeyTable));
strcpy(szKeyTable, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
if(m_SpecialChar.GetCheck())
{
strcat(szKeyTable, "~!@#$%^&()-=_+[]{}");
}
int iKeyTable = strlen(szKeyTable);
Math::RandomInt random(GetTickCount());
for(int i = 0; i < iSize; ++i)
{
int key = random.Next(iKeyTable);
szPassword[i] = szKeyTable[key];
}
szPassword[iSize] = 0;
MD5_CTX context;
unsigned char digest[16] ;
memset( digest, 0, sizeof( char ) * 16 ) ;
MD5Init(&context);
MD5Update(&context, reinterpret_cast<unsigned char *>( szPassword ), strlen( szPassword ) );
MD5Final(digest, &context);
ZeroMemory(szPasswordMD5, sizeof(szPasswordMD5));
for (int i = 0; i < 16; ++i)
{
sprintf (szPasswordMD5 + i * 2, "%02x", digest[i]);
}
char szOut[2048];
sprintf(szOut, "Password : %s\r\n\r\nMD5 : %s", szPassword, szPasswordMD5);
m_Output.SetWindowText(szOut);
return;
}
void CPasswordGeneratorDlg::OnBnClickedButton2()
{
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
char szPassword[512];
char szPasswordMD5[512];
int iSize = 0;
m_InputCode.GetWindowText(szPassword, 512);
iSize = strlen(szPassword);
if(iSize < 4 || iSize > 32)
{
AfxMessageBox("4자 이상 32자 이하 여야합니다.", MB_OK);
return;
}
MD5_CTX context;
unsigned char digest[16] ;
memset( digest, 0, sizeof( char ) * 16 ) ;
MD5Init(&context);
MD5Update(&context, reinterpret_cast<unsigned char *>( szPassword ), strlen( szPassword ) );
MD5Final(digest, &context);
ZeroMemory(szPasswordMD5, sizeof(szPasswordMD5));
for (int i = 0; i < 16; ++i)
{
sprintf (szPasswordMD5 + i * 2, "%02x", digest[i]);
}
char szOut[2048];
sprintf(szOut, "Password : %s\r\n\r\nMD5 : %s", szPassword, szPasswordMD5);
m_Output.SetWindowText(szOut);
}

View File

@@ -0,0 +1,39 @@
// PasswordGeneratorDlg.h : 헤더 파일
//
#pragma once
#include "afxwin.h"
// CPasswordGeneratorDlg 대화 상자
class CPasswordGeneratorDlg : public CDialog
{
// 생성
public:
CPasswordGeneratorDlg(CWnd* pParent = NULL); // 표준 생성자
// 대화 상자 데이터
enum { IDD = IDD_PASSWORDGENERATOR_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원
// 구현
protected:
HICON m_hIcon;
// 메시지 맵 함수를 생성했습니다.
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
CEdit m_PasswordSize;
CEdit m_Output;
afx_msg void OnBnClickedButton1();
CButton m_SpecialChar;
afx_msg void OnBnClickedButton2();
CEdit m_InputCode;
};

View File

@@ -0,0 +1,71 @@
================================================================================
MFC 라이브러리 : PasswordGenerator 프로젝트 개요
================================================================================
응용 프로그램 마법사를 사용하여 PasswordGenerator 응용 프로그램을 만듭니다. 이 응용
프로그램에서는 기본적인 MFC 사용 밥법과 응용 프로그램 작성 방법을 설명합니다.
이 파일에는 PasswordGenerator 응용 프로그램을 구성하는 각 파일에 대한 개요가 포함되어
있습니다.
PasswordGenerator.vcproj
응용 프로그램 마법사를 사용하여 생성된 VC++ 프로젝트의 주 프로젝트 파일입니다.
이 파일에는 파일을 생성한 Visual C++ 버전 정보 및 응용 프로그램 마법사에서 선택한 플랫폼,
구성, 프로젝트 기능 등의 정보가 포함됩니다.
PasswordGenerator.h
응용 프로그램의 주 헤더 파일입니다. 이 파일에는 다른 프로젝트에 관련된 Resource.h와 같은
특정 헤더가 포함되며 CPasswordGeneratorApp 응용 프로그램 클래스가 선언됩니다.
PasswordGenerator.cpp
CPasswordGeneratorApp 응용 프로그램 클래스를 포함하는 주 응용 프로그램의 소스 파일입니다.
PasswordGenerator.rc
프로그램에서 사용하는 모든 Microsoft Windows 리소스가 나열된 파일입니다.
이 파일에는 RES 하위 디렉터리에 저장된 아이콘, 비트맵 및 커서가 포함되며
Microsoft Visual C++에서 직접 이 파일을 편집할 수도 있습니다. 사용자의 프로젝트
리소스는 1042에 들어 있습니다.
res\PasswordGenerator.ico
응용 프로그램의 아이콘으로 사용되는 아이콘 파일입니다.
이 아이콘은 주 리소스 파일인 PasswordGenerator.rc에 포함됩니다.
res\PasswordGenerator.rc2
Microsoft Visual C++에서 편집할 수 없는 리소스가 포함된 파일입니다.
리소스 편집기에서 편집할 수 없는 모든 리소스는 이 파일에 포함되어 있습니다.
/////////////////////////////////////////////////////////////////////////////
응용 프로그램 마법사에서는 단일 대화 상자 클래스를 만듭니다.
PasswordGeneratorDlg.h, PasswordGeneratorDlg.cpp - 대화 상자
CPasswordGeneratorDlg 클래스를 포함하는 파일입니다. 이 클래스에는 응용 프로그램의
주 대화 상자에 대한 동작이 정의됩니다. 대화 상자의 템플릿은 PasswordGenerator.rc에
있으며 Microsoft Visual C++에서 편집할 수 있습니다.
/////////////////////////////////////////////////////////////////////////////
기타 표준 파일
StdAfx.h, StdAfx.cpp
미리 컴파일된 헤더 파일(PCH) PasswordGenerator.pch 및 미리 컴파일된
형식 파일 StdAfx.obj를 빌드할 때 사용되는 파일입니다.
Resource.h
새로운 리소스 ID를 정의하는 표준 헤더 파일입니다.
Microsoft Visual C++에서 이 파일을 읽고 업데이트합니다.
/////////////////////////////////////////////////////////////////////////////
기타 정보
응용 프로그램 마법사에서는 "TODO:"를 사용하여 추가하거나 사용자 지정해야 하는
소스 코드를 나타냅니다.
응용 프로그램에서 공유 DLL에 MFC를 사용하고 응용 프로그램의 언어가 운영 체제의
언어와 다른 경우 Microsoft Visual C++ CD-ROM의 Win\System 디렉터리에 있는
해당 지역의 리소스인 MFC70XXX.DLL을 컴퓨터의 system 또는 system32 디렉터리에
복사한 다음 MFCLOC.DLL로 이름을 바꾸어야 합니다. "XXX"는 해당 언어를 나타내는
약어입니다. 예를 들어 MFC70DEU.DLL에는 독일어로 변환된 리소스가 포함됩니다.
이런 작업을 하지 않으면 응용 프로그램의 일부 UI 요소가 운영 체제의 언어로
남아 있게 됩니다.
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Windows.PasswordGenerator"
type="win32"
/>
<description>여기에 응용 프로그램 설명을 추가합니다.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

View File

@@ -0,0 +1,13 @@
//
// PasswordGenerator.RC2 - resources Microsoft Visual C++에서 직접 편집하지 않는 리소스
//
#ifdef APSTUDIO_INVOKED
#error 이 파일은 Microsoft Visual C++에서 편집할 수 없습니다.
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// 여기에 수동으로 편집한 리소스를 추가합니다.
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,26 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by PasswordGenerator.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_PASSWORDGENERATOR_DIALOG 102
#define IDR_MAINFRAME 128
#define IDC_EDIT1 1000
#define IDC_EDIT2 1001
#define IDC_BUTTON1 1002
#define IDC_CHECK1 1003
#define IDC_EDIT3 1004
#define IDC_BUTTON2 1005
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,7 @@
// stdafx.cpp : 표준 포함 파일을 포함하는 소스 파일입니다.
// PasswordGenerator.pch는 미리 컴파일된 헤더가 됩니다.
// stdafx.obj는 미리 컴파일된 형식 정보를 포함합니다.
#include "stdafx.h"

View File

@@ -0,0 +1,41 @@
// stdafx.h : 잘 변경되지 않고 자주 사용하는
// 표준 시스템 포함 파일 및 프로젝트 관련 포함 파일이
// 들어 있는 포함 파일입니다.
#pragma once
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Windows 헤더에서 거의 사용되지 않는 내용을 제외시킵니다.
#endif
// 아래 지정된 플랫폼보다 우선하는 플랫폼을 대상으로 하는 경우 다음 정의를 수정하십시오.
// 다른 플랫폼에 사용되는 해당 값의 최신 정보는 MSDN을 참조하십시오.
#ifndef WINVER // Windows 95 및 Windows NT 4 이후 버전에서만 기능을 사용할 수 있습니다.
#define WINVER 0x0400 // Windows 98과 Windows 2000 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
#endif
#ifndef _WIN32_WINNT // Windows NT 4 이후 버전에서만 기능을 사용할 수 있습니다.
#define _WIN32_WINNT 0x0400 // Windows 98과 Windows 2000 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
#endif
#ifndef _WIN32_WINDOWS // Windows 98 이후 버전에서만 기능을 사용할 수 있습니다.
#define _WIN32_WINDOWS 0x0410 // Windows Me 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
#endif
#ifndef _WIN32_IE // IE 4.0 이후 버전에서만 기능을 사용할 수 있습니다.
#define _WIN32_IE 0x0400 // IE 5.0 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
#endif
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 일부 CString 생성자는 명시적으로 선언됩니다.
// MFC의 공통 부분과 무시 가능한 경고 메시지에 대한 숨기기를 해제합니다.
#define _AFX_ALL_WARNINGS
#include <afxwin.h> // MFC 핵심 및 표준 구성 요소
#include <afxext.h> // MFC 익스텐션
#include <afxdtctl.h> // Internet Explorer 4 공용 컨트롤에 대한 MFC 지원
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // Windows 공용 컨트롤에 대한 MFC 지원
#endif // _AFX_NO_AFXCMN_SUPPORT