diff --git a/programs/other/TinyHashView/BUILD_KEX.SH b/programs/other/TinyHashView/BUILD_KEX.SH index 8c17266fda..3620a7f775 100644 --- a/programs/other/TinyHashView/BUILD_KEX.SH +++ b/programs/other/TinyHashView/BUILD_KEX.SH @@ -1,2 +1,2 @@ #SHS -/kolibrios/develop/tcc/tcc algorithms/md5.c algorithms/sha1.c algorithms/sha256.c thashview.c -o thashview -lck +/kolibrios/develop/tcc/tcc thashview.c -o thashview -lck -lcryptal diff --git a/programs/other/TinyHashView/Makefile b/programs/other/TinyHashView/Makefile index e283f19138..98b1e7380d 100755 --- a/programs/other/TinyHashView/Makefile +++ b/programs/other/TinyHashView/Makefile @@ -5,13 +5,12 @@ NAME=thashview KTCC=$(KTCC_DIR)/bin/kos32-tcc KPACK=kpack -SRC=thashview.c algorithms/*.c -CFLAGS=-nostdinc -I $(KTCC_DIR)/libc/include -LFLAGS=-nostdlib -L $(KTCC_DIR)/bin/lib $(KTCC_DIR)/bin/lib/start.o -LIBS = -lck +SRC=thashview.c +CFLAGS=-I $(KTCC_DIR)/libc/include +LIBS = -lck -lcryptal all: - $(KTCC) $(CFLAGS) $(LFLAGS) $(SRC) $(LIBS) -o $(NAME) + $(KTCC) $(CFLAGS) $(SRC) $(LIBS) -o $(NAME) $(KPACK) $(NAME) clean: diff --git a/programs/other/TinyHashView/algorithms/md5.c b/programs/other/TinyHashView/algorithms/md5.c deleted file mode 100644 index e67f840dd5..0000000000 --- a/programs/other/TinyHashView/algorithms/md5.c +++ /dev/null @@ -1,189 +0,0 @@ -/********************************************************************* -* Filename: md5.c -* Author: Brad Conte (brad AT bradconte.com) -* Copyright: -* Disclaimer: This code is presented "as is" without any guarantees. -* Details: Implementation of the MD5 hashing algorithm. - Algorithm specification can be found here: - * http://tools.ietf.org/html/rfc1321 - This implementation uses little endian byte order. -*********************************************************************/ - -/*************************** HEADER FILES ***************************/ -#include -#include -#include "md5.h" - -/****************************** MACROS ******************************/ -#define ROTLEFT(a,b) ((a << b) | (a >> (32-b))) - -#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)) - -#define FF(a,b,c,d,m,s,t) { a += F(b,c,d) + m + t; \ - a = b + ROTLEFT(a,s); } -#define GG(a,b,c,d,m,s,t) { a += G(b,c,d) + m + t; \ - a = b + ROTLEFT(a,s); } -#define HH(a,b,c,d,m,s,t) { a += H(b,c,d) + m + t; \ - a = b + ROTLEFT(a,s); } -#define II(a,b,c,d,m,s,t) { a += I(b,c,d) + m + t; \ - a = b + ROTLEFT(a,s); } - -/*********************** FUNCTION DEFINITIONS ***********************/ -void md5_transform(MD5_CTX *ctx, const BYTE data[]) -{ - WORD a, b, c, d, m[16], i, j; - - // MD5 specifies big endian byte order, but this implementation assumes a little - // endian byte order CPU. Reverse all the bytes upon input, and re-reverse them - // on output (in md5_final()). - for (i = 0, j = 0; i < 16; ++i, j += 4) - m[i] = (data[j]) + (data[j + 1] << 8) + (data[j + 2] << 16) + (data[j + 3] << 24); - - a = ctx->state[0]; - b = ctx->state[1]; - c = ctx->state[2]; - d = ctx->state[3]; - - FF(a,b,c,d,m[0], 7,0xd76aa478); - FF(d,a,b,c,m[1], 12,0xe8c7b756); - FF(c,d,a,b,m[2], 17,0x242070db); - FF(b,c,d,a,m[3], 22,0xc1bdceee); - FF(a,b,c,d,m[4], 7,0xf57c0faf); - FF(d,a,b,c,m[5], 12,0x4787c62a); - FF(c,d,a,b,m[6], 17,0xa8304613); - FF(b,c,d,a,m[7], 22,0xfd469501); - FF(a,b,c,d,m[8], 7,0x698098d8); - FF(d,a,b,c,m[9], 12,0x8b44f7af); - FF(c,d,a,b,m[10],17,0xffff5bb1); - FF(b,c,d,a,m[11],22,0x895cd7be); - FF(a,b,c,d,m[12], 7,0x6b901122); - FF(d,a,b,c,m[13],12,0xfd987193); - FF(c,d,a,b,m[14],17,0xa679438e); - FF(b,c,d,a,m[15],22,0x49b40821); - - GG(a,b,c,d,m[1], 5,0xf61e2562); - GG(d,a,b,c,m[6], 9,0xc040b340); - GG(c,d,a,b,m[11],14,0x265e5a51); - GG(b,c,d,a,m[0], 20,0xe9b6c7aa); - GG(a,b,c,d,m[5], 5,0xd62f105d); - GG(d,a,b,c,m[10], 9,0x02441453); - GG(c,d,a,b,m[15],14,0xd8a1e681); - GG(b,c,d,a,m[4], 20,0xe7d3fbc8); - GG(a,b,c,d,m[9], 5,0x21e1cde6); - GG(d,a,b,c,m[14], 9,0xc33707d6); - GG(c,d,a,b,m[3], 14,0xf4d50d87); - GG(b,c,d,a,m[8], 20,0x455a14ed); - GG(a,b,c,d,m[13], 5,0xa9e3e905); - GG(d,a,b,c,m[2], 9,0xfcefa3f8); - GG(c,d,a,b,m[7], 14,0x676f02d9); - GG(b,c,d,a,m[12],20,0x8d2a4c8a); - - HH(a,b,c,d,m[5], 4,0xfffa3942); - HH(d,a,b,c,m[8], 11,0x8771f681); - HH(c,d,a,b,m[11],16,0x6d9d6122); - HH(b,c,d,a,m[14],23,0xfde5380c); - HH(a,b,c,d,m[1], 4,0xa4beea44); - HH(d,a,b,c,m[4], 11,0x4bdecfa9); - HH(c,d,a,b,m[7], 16,0xf6bb4b60); - HH(b,c,d,a,m[10],23,0xbebfbc70); - HH(a,b,c,d,m[13], 4,0x289b7ec6); - HH(d,a,b,c,m[0], 11,0xeaa127fa); - HH(c,d,a,b,m[3], 16,0xd4ef3085); - HH(b,c,d,a,m[6], 23,0x04881d05); - HH(a,b,c,d,m[9], 4,0xd9d4d039); - HH(d,a,b,c,m[12],11,0xe6db99e5); - HH(c,d,a,b,m[15],16,0x1fa27cf8); - HH(b,c,d,a,m[2], 23,0xc4ac5665); - - II(a,b,c,d,m[0], 6,0xf4292244); - II(d,a,b,c,m[7], 10,0x432aff97); - II(c,d,a,b,m[14],15,0xab9423a7); - II(b,c,d,a,m[5], 21,0xfc93a039); - II(a,b,c,d,m[12], 6,0x655b59c3); - II(d,a,b,c,m[3], 10,0x8f0ccc92); - II(c,d,a,b,m[10],15,0xffeff47d); - II(b,c,d,a,m[1], 21,0x85845dd1); - II(a,b,c,d,m[8], 6,0x6fa87e4f); - II(d,a,b,c,m[15],10,0xfe2ce6e0); - II(c,d,a,b,m[6], 15,0xa3014314); - II(b,c,d,a,m[13],21,0x4e0811a1); - II(a,b,c,d,m[4], 6,0xf7537e82); - II(d,a,b,c,m[11],10,0xbd3af235); - II(c,d,a,b,m[2], 15,0x2ad7d2bb); - II(b,c,d,a,m[9], 21,0xeb86d391); - - ctx->state[0] += a; - ctx->state[1] += b; - ctx->state[2] += c; - ctx->state[3] += d; -} - -void md5_init(MD5_CTX *ctx) -{ - ctx->datalen = 0; - ctx->bitlen = 0; - ctx->state[0] = 0x67452301; - ctx->state[1] = 0xEFCDAB89; - ctx->state[2] = 0x98BADCFE; - ctx->state[3] = 0x10325476; -} - -void md5_update(MD5_CTX *ctx, const BYTE data[], size_t len) -{ - size_t i; - - for (i = 0; i < len; ++i) { - ctx->data[ctx->datalen] = data[i]; - ctx->datalen++; - if (ctx->datalen == 64) { - md5_transform(ctx, ctx->data); - ctx->bitlen += 512; - ctx->datalen = 0; - } - } -} - -void md5_final(MD5_CTX *ctx, BYTE hash[]) -{ - size_t i; - - i = ctx->datalen; - - // Pad whatever data is left in the buffer. - if (ctx->datalen < 56) { - ctx->data[i++] = 0x80; - while (i < 56) - ctx->data[i++] = 0x00; - } - else if (ctx->datalen >= 56) { - ctx->data[i++] = 0x80; - while (i < 64) - ctx->data[i++] = 0x00; - md5_transform(ctx, ctx->data); - memset(ctx->data, 0, 56); - } - - // Append to the padding the total message's length in bits and transform. - ctx->bitlen += ctx->datalen * 8; - ctx->data[56] = ctx->bitlen; - ctx->data[57] = ctx->bitlen >> 8; - ctx->data[58] = ctx->bitlen >> 16; - ctx->data[59] = ctx->bitlen >> 24; - ctx->data[60] = ctx->bitlen >> 32; - ctx->data[61] = ctx->bitlen >> 40; - ctx->data[62] = ctx->bitlen >> 48; - ctx->data[63] = ctx->bitlen >> 56; - md5_transform(ctx, ctx->data); - - // Since this implementation uses little endian byte ordering and MD uses big endian, - // reverse all the bytes when copying the final state to the output hash. - for (i = 0; i < 4; ++i) { - hash[i] = (ctx->state[0] >> (i * 8)) & 0x000000ff; - hash[i + 4] = (ctx->state[1] >> (i * 8)) & 0x000000ff; - hash[i + 8] = (ctx->state[2] >> (i * 8)) & 0x000000ff; - hash[i + 12] = (ctx->state[3] >> (i * 8)) & 0x000000ff; - } -} diff --git a/programs/other/TinyHashView/algorithms/md5.h b/programs/other/TinyHashView/algorithms/md5.h deleted file mode 100644 index 1370387cee..0000000000 --- a/programs/other/TinyHashView/algorithms/md5.h +++ /dev/null @@ -1,34 +0,0 @@ -/********************************************************************* -* Filename: md5.h -* Author: Brad Conte (brad AT bradconte.com) -* Copyright: -* Disclaimer: This code is presented "as is" without any guarantees. -* Details: Defines the API for the corresponding MD5 implementation. -*********************************************************************/ - -#ifndef MD5_H -#define MD5_H - -/*************************** HEADER FILES ***************************/ -#include - -/****************************** MACROS ******************************/ -#define MD5_BLOCK_SIZE 16 // MD5 outputs a 16 byte digest - -/**************************** DATA TYPES ****************************/ -typedef unsigned char BYTE; // 8-bit byte -typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines - -typedef struct { - BYTE data[64]; - WORD datalen; - unsigned long long bitlen; - WORD state[4]; -} MD5_CTX; - -/*********************** FUNCTION DECLARATIONS **********************/ -void md5_init(MD5_CTX *ctx); -void md5_update(MD5_CTX *ctx, const BYTE data[], size_t len); -void md5_final(MD5_CTX *ctx, BYTE hash[]); - -#endif // MD5_H diff --git a/programs/other/TinyHashView/algorithms/sha1.c b/programs/other/TinyHashView/algorithms/sha1.c deleted file mode 100644 index a982db00df..0000000000 --- a/programs/other/TinyHashView/algorithms/sha1.c +++ /dev/null @@ -1,149 +0,0 @@ -/********************************************************************* -* Filename: sha1.c -* Author: Brad Conte (brad AT bradconte.com) -* Copyright: -* Disclaimer: This code is presented "as is" without any guarantees. -* Details: Implementation of the SHA1 hashing algorithm. - Algorithm specification can be found here: - * http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf - This implementation uses little endian byte order. -*********************************************************************/ - -/*************************** HEADER FILES ***************************/ -#include -#include -#include "sha1.h" - -/****************************** MACROS ******************************/ -#define ROTLEFT(a, b) ((a << b) | (a >> (32 - b))) - -/*********************** FUNCTION DEFINITIONS ***********************/ -void sha1_transform(SHA1_CTX *ctx, const BYTE data[]) -{ - WORD a, b, c, d, e, i, j, t, m[80]; - - for (i = 0, j = 0; i < 16; ++i, j += 4) - m[i] = (data[j] << 24) + (data[j + 1] << 16) + (data[j + 2] << 8) + (data[j + 3]); - for ( ; i < 80; ++i) { - m[i] = (m[i - 3] ^ m[i - 8] ^ m[i - 14] ^ m[i - 16]); - m[i] = (m[i] << 1) | (m[i] >> 31); - } - - a = ctx->state[0]; - b = ctx->state[1]; - c = ctx->state[2]; - d = ctx->state[3]; - e = ctx->state[4]; - - for (i = 0; i < 20; ++i) { - t = ROTLEFT(a, 5) + ((b & c) ^ (~b & d)) + e + ctx->k[0] + m[i]; - e = d; - d = c; - c = ROTLEFT(b, 30); - b = a; - a = t; - } - for ( ; i < 40; ++i) { - t = ROTLEFT(a, 5) + (b ^ c ^ d) + e + ctx->k[1] + m[i]; - e = d; - d = c; - c = ROTLEFT(b, 30); - b = a; - a = t; - } - for ( ; i < 60; ++i) { - t = ROTLEFT(a, 5) + ((b & c) ^ (b & d) ^ (c & d)) + e + ctx->k[2] + m[i]; - e = d; - d = c; - c = ROTLEFT(b, 30); - b = a; - a = t; - } - for ( ; i < 80; ++i) { - t = ROTLEFT(a, 5) + (b ^ c ^ d) + e + ctx->k[3] + m[i]; - e = d; - d = c; - c = ROTLEFT(b, 30); - b = a; - a = t; - } - - ctx->state[0] += a; - ctx->state[1] += b; - ctx->state[2] += c; - ctx->state[3] += d; - ctx->state[4] += e; -} - -void sha1_init(SHA1_CTX *ctx) -{ - ctx->datalen = 0; - ctx->bitlen = 0; - ctx->state[0] = 0x67452301; - ctx->state[1] = 0xEFCDAB89; - ctx->state[2] = 0x98BADCFE; - ctx->state[3] = 0x10325476; - ctx->state[4] = 0xc3d2e1f0; - ctx->k[0] = 0x5a827999; - ctx->k[1] = 0x6ed9eba1; - ctx->k[2] = 0x8f1bbcdc; - ctx->k[3] = 0xca62c1d6; -} - -void sha1_update(SHA1_CTX *ctx, const BYTE data[], size_t len) -{ - size_t i; - - for (i = 0; i < len; ++i) { - ctx->data[ctx->datalen] = data[i]; - ctx->datalen++; - if (ctx->datalen == 64) { - sha1_transform(ctx, ctx->data); - ctx->bitlen += 512; - ctx->datalen = 0; - } - } -} - -void sha1_final(SHA1_CTX *ctx, BYTE hash[]) -{ - WORD i; - - i = ctx->datalen; - - // Pad whatever data is left in the buffer. - if (ctx->datalen < 56) { - ctx->data[i++] = 0x80; - while (i < 56) - ctx->data[i++] = 0x00; - } - else { - ctx->data[i++] = 0x80; - while (i < 64) - ctx->data[i++] = 0x00; - sha1_transform(ctx, ctx->data); - memset(ctx->data, 0, 56); - } - - // Append to the padding the total message's length in bits and transform. - ctx->bitlen += ctx->datalen * 8; - ctx->data[63] = ctx->bitlen; - ctx->data[62] = ctx->bitlen >> 8; - ctx->data[61] = ctx->bitlen >> 16; - ctx->data[60] = ctx->bitlen >> 24; - ctx->data[59] = ctx->bitlen >> 32; - ctx->data[58] = ctx->bitlen >> 40; - ctx->data[57] = ctx->bitlen >> 48; - ctx->data[56] = ctx->bitlen >> 56; - sha1_transform(ctx, ctx->data); - - // Since this implementation uses little endian byte ordering and MD uses big endian, - // reverse all the bytes when copying the final state to the output hash. - for (i = 0; i < 4; ++i) { - hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0x000000ff; - hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff; - hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff; - hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff; - hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff; - } -} diff --git a/programs/other/TinyHashView/algorithms/sha1.h b/programs/other/TinyHashView/algorithms/sha1.h deleted file mode 100644 index f32bb7c04d..0000000000 --- a/programs/other/TinyHashView/algorithms/sha1.h +++ /dev/null @@ -1,35 +0,0 @@ -/********************************************************************* -* Filename: sha1.h -* Author: Brad Conte (brad AT bradconte.com) -* Copyright: -* Disclaimer: This code is presented "as is" without any guarantees. -* Details: Defines the API for the corresponding SHA1 implementation. -*********************************************************************/ - -#ifndef SHA1_H -#define SHA1_H - -/*************************** HEADER FILES ***************************/ -#include - -/****************************** MACROS ******************************/ -#define SHA1_BLOCK_SIZE 20 // SHA1 outputs a 20 byte digest - -/**************************** DATA TYPES ****************************/ -typedef unsigned char BYTE; // 8-bit byte -typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines - -typedef struct { - BYTE data[64]; - WORD datalen; - unsigned long long bitlen; - WORD state[5]; - WORD k[4]; -} SHA1_CTX; - -/*********************** FUNCTION DECLARATIONS **********************/ -void sha1_init(SHA1_CTX *ctx); -void sha1_update(SHA1_CTX *ctx, const BYTE data[], size_t len); -void sha1_final(SHA1_CTX *ctx, BYTE hash[]); - -#endif // SHA1_H diff --git a/programs/other/TinyHashView/algorithms/sha256.c b/programs/other/TinyHashView/algorithms/sha256.c deleted file mode 100644 index 196a51461c..0000000000 --- a/programs/other/TinyHashView/algorithms/sha256.c +++ /dev/null @@ -1,158 +0,0 @@ -/********************************************************************* -* Filename: sha256.c -* Author: Brad Conte (brad AT bradconte.com) -* Copyright: -* Disclaimer: This code is presented "as is" without any guarantees. -* Details: Implementation of the SHA-256 hashing algorithm. - SHA-256 is one of the three algorithms in the SHA2 - specification. The others, SHA-384 and SHA-512, are not - offered in this implementation. - Algorithm specification can be found here: - * http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf - This implementation uses little endian byte order. -*********************************************************************/ - -/*************************** HEADER FILES ***************************/ -#include -#include -#include "sha256.h" - -/****************************** MACROS ******************************/ -#define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b)))) -#define ROTRIGHT(a,b) (((a) >> (b)) | ((a) << (32-(b)))) - -#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z))) -#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) -#define EP0(x) (ROTRIGHT(x,2) ^ ROTRIGHT(x,13) ^ ROTRIGHT(x,22)) -#define EP1(x) (ROTRIGHT(x,6) ^ ROTRIGHT(x,11) ^ ROTRIGHT(x,25)) -#define SIG0(x) (ROTRIGHT(x,7) ^ ROTRIGHT(x,18) ^ ((x) >> 3)) -#define SIG1(x) (ROTRIGHT(x,17) ^ ROTRIGHT(x,19) ^ ((x) >> 10)) - -/**************************** VARIABLES *****************************/ -static const WORD k[64] = { - 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5, - 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174, - 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da, - 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967, - 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85, - 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070, - 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3, - 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 -}; - -/*********************** FUNCTION DEFINITIONS ***********************/ -void sha256_transform(SHA256_CTX *ctx, const BYTE data[]) -{ - WORD a, b, c, d, e, f, g, h, i, j, t1, t2, m[64]; - - for (i = 0, j = 0; i < 16; ++i, j += 4) - m[i] = (data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 8) | (data[j + 3]); - for ( ; i < 64; ++i) - m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16]; - - a = ctx->state[0]; - b = ctx->state[1]; - c = ctx->state[2]; - d = ctx->state[3]; - e = ctx->state[4]; - f = ctx->state[5]; - g = ctx->state[6]; - h = ctx->state[7]; - - for (i = 0; i < 64; ++i) { - t1 = h + EP1(e) + CH(e,f,g) + k[i] + m[i]; - t2 = EP0(a) + MAJ(a,b,c); - h = g; - g = f; - f = e; - e = d + t1; - d = c; - c = b; - b = a; - a = t1 + t2; - } - - ctx->state[0] += a; - ctx->state[1] += b; - ctx->state[2] += c; - ctx->state[3] += d; - ctx->state[4] += e; - ctx->state[5] += f; - ctx->state[6] += g; - ctx->state[7] += h; -} - -void sha256_init(SHA256_CTX *ctx) -{ - ctx->datalen = 0; - ctx->bitlen = 0; - ctx->state[0] = 0x6a09e667; - ctx->state[1] = 0xbb67ae85; - ctx->state[2] = 0x3c6ef372; - ctx->state[3] = 0xa54ff53a; - ctx->state[4] = 0x510e527f; - ctx->state[5] = 0x9b05688c; - ctx->state[6] = 0x1f83d9ab; - ctx->state[7] = 0x5be0cd19; -} - -void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len) -{ - WORD i; - - for (i = 0; i < len; ++i) { - ctx->data[ctx->datalen] = data[i]; - ctx->datalen++; - if (ctx->datalen == 64) { - sha256_transform(ctx, ctx->data); - ctx->bitlen += 512; - ctx->datalen = 0; - } - } -} - -void sha256_final(SHA256_CTX *ctx, BYTE hash[]) -{ - WORD i; - - i = ctx->datalen; - - // Pad whatever data is left in the buffer. - if (ctx->datalen < 56) { - ctx->data[i++] = 0x80; - while (i < 56) - ctx->data[i++] = 0x00; - } - else { - ctx->data[i++] = 0x80; - while (i < 64) - ctx->data[i++] = 0x00; - sha256_transform(ctx, ctx->data); - memset(ctx->data, 0, 56); - } - - // Append to the padding the total message's length in bits and transform. - ctx->bitlen += ctx->datalen * 8; - ctx->data[63] = ctx->bitlen; - ctx->data[62] = ctx->bitlen >> 8; - ctx->data[61] = ctx->bitlen >> 16; - ctx->data[60] = ctx->bitlen >> 24; - ctx->data[59] = ctx->bitlen >> 32; - ctx->data[58] = ctx->bitlen >> 40; - ctx->data[57] = ctx->bitlen >> 48; - ctx->data[56] = ctx->bitlen >> 56; - sha256_transform(ctx, ctx->data); - - // Since this implementation uses little endian byte ordering and SHA uses big endian, - // reverse all the bytes when copying the final state to the output hash. - for (i = 0; i < 4; ++i) { - hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0x000000ff; - hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff; - hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff; - hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff; - hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff; - hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff; - hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff; - hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff; - } -} diff --git a/programs/other/TinyHashView/algorithms/sha256.h b/programs/other/TinyHashView/algorithms/sha256.h deleted file mode 100644 index 7123a30dd4..0000000000 --- a/programs/other/TinyHashView/algorithms/sha256.h +++ /dev/null @@ -1,34 +0,0 @@ -/********************************************************************* -* Filename: sha256.h -* Author: Brad Conte (brad AT bradconte.com) -* Copyright: -* Disclaimer: This code is presented "as is" without any guarantees. -* Details: Defines the API for the corresponding SHA1 implementation. -*********************************************************************/ - -#ifndef SHA256_H -#define SHA256_H - -/*************************** HEADER FILES ***************************/ -#include - -/****************************** MACROS ******************************/ -#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest - -/**************************** DATA TYPES ****************************/ -typedef unsigned char BYTE; // 8-bit byte -typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines - -typedef struct { - BYTE data[64]; - WORD datalen; - unsigned long long bitlen; - WORD state[8]; -} SHA256_CTX; - -/*********************** FUNCTION DECLARATIONS **********************/ -void sha256_init(SHA256_CTX *ctx); -void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len); -void sha256_final(SHA256_CTX *ctx, BYTE hash[]); - -#endif // SHA256_H diff --git a/programs/other/TinyHashView/kos32sys.h b/programs/other/TinyHashView/kos32sys.h deleted file mode 100644 index 5b269573b9..0000000000 --- a/programs/other/TinyHashView/kos32sys.h +++ /dev/null @@ -1,802 +0,0 @@ -#ifndef __KOS_32_SYS_H__ -#define __KOS_32_SYS_H__ - -// file header taken from newlib -// added many sys functions, compatible with tcc - -//#include -//#include -#include -#include -typedef unsigned int uint32_t; -typedef int int32_t; -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned long long uint64_t; - -#ifdef __cplusplus -extern "C" { -#endif - -//#ifdef CONFIG_DEBUF -// #define DBG(format,...) printf(format,##__VA_ARGS__) -//#else -// #define DBG(format,...) -//#endif - -#define TYPE_3_BORDER_WIDTH 5 -#define WIN_STATE_MINIMIZED 0x02 -#define WIN_STATE_ROLLED 0x04 -#define POS_SCREEN 0 -#define POS_WINDOW 1 - -#define IPC_NOBUFFER 1 -#define IPC_LOCKED 2 -#define IPC_OVERFLOW 3 -#define IPC_NOPID 4 - -#define SHM_OPEN 0x00 -#define SHM_OPEN_ALWAYS 0x04 -#define SHM_CREATE 0x08 -#define SHM_READ 0x00 -#define SHM_WRITE 0x01 - - - -typedef unsigned int color_t; - - -typedef union __attribute__((packed)) pos_t -{ - uint32_t val; - struct - { - short x; - short y; - }; -} pos_t; - - -typedef union __attribute__((packed)) oskey_t -{ - uint32_t val; - struct - { - uint8_t state; - uint8_t code; - uint16_t ctrl_key; - }; -} oskey_t; - -typedef struct -{ - unsigned handle; - unsigned io_code; - void *input; - int inp_size; - void *output; - int out_size; -}ioctl_t; - -typedef union -{ - struct - { - void *data; - size_t size; - } x; - unsigned long long raw; -}ufile_t; - -struct kolibri_system_colors { - color_t frame_area; - color_t grab_bar; - color_t grab_bar_button; - color_t grab_button_text; - color_t grab_text; - color_t work_area; - color_t work_button; - color_t work_button_text; - color_t work_text; - color_t work_graph; -}; - - -struct blit_call -{ - int dstx; - int dsty; - int w; - int h; - - int srcx; - int srcy; - int srcw; - int srch; - - void *bitmap; - int stride; -}; - -struct ipc_message -{ - uint32_t pid; // PID of sending thread - uint32_t datalen; // data bytes - char data[0]; // data begin -}; - -struct ipc_buffer -{ - uint32_t lock; // nonzero is locked - uint32_t used; // used bytes in buffer - struct ipc_message data[0]; // data begin -}; - -static inline void begin_draw(void) -{ - __asm__ __volatile__( - "int $0x40" ::"a"(12),"b"(1)); -}; - -static inline -void end_draw(void) -{ - __asm__ __volatile__( - "int $0x40" ::"a"(12),"b"(2)); -}; - -static inline -void sys_create_window(int x, int y, int w, int h, const char *name, - color_t workcolor, uint32_t style) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(0), - "b"((x << 16) | ((w-1) & 0xFFFF)), - "c"((y << 16) | ((h-1) & 0xFFFF)), - "d"((style << 24) | (workcolor & 0xFFFFFF)), - "D"(name), - "S"(0) : "memory"); -}; - -static inline -void define_button(uint32_t x_w, uint32_t y_h, uint32_t id, uint32_t color) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(8), - "b"(x_w), - "c"(y_h), - "d"(id), - "S"(color)); -}; - -static inline -void draw_line(int xs, int ys, int xe, int ye, color_t color) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(38), "d"(color), - "b"((xs << 16) | xe), - "c"((ys << 16) | ye)); -} - -static inline -void draw_bar(int x, int y, int w, int h, color_t color) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(13), "d"(color), - "b"((x << 16) | w), - "c"((y << 16) | h)); -} - -static inline -void draw_bitmap(void *bitmap, int x, int y, int w, int h) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(7), "b"(bitmap), - "c"((w << 16) | h), - "d"((x << 16) | y)); -} - -static inline -void draw_text_sys(const char *text, int x, int y, int len, color_t color) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(4),"d"(text), - "b"((x << 16) | y), - "S"(len),"c"(color) - :"memory"); -} - -static inline -uint32_t get_skin_height(void) -{ - uint32_t height; - - __asm__ __volatile__( - "int $0x40 \n\t" - :"=a"(height) - :"a"(48),"b"(4)); - return height; -}; - -static inline -pos_t get_mouse_pos(int origin) -{ - pos_t val; - - __asm__ __volatile__( - "int $0x40 \n\t" - "rol $16, %%eax" - :"=a"(val) - :"a"(37),"b"(origin)); - return val; -} - -static inline -uint32_t get_mouse_buttons(void) -{ - uint32_t val; - - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(37),"b"(2)); - return val; -}; - -static inline -uint32_t get_mouse_wheels(void) -{ - uint32_t val; - - __asm__ __volatile__( - "int $0x40 \n\t" - :"=a"(val) - :"a"(37),"b"(7)); - return val; -}; - -static inline uint32_t load_cursor(void *path, uint32_t flags) -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(37), "b"(4), "c"(path), "d"(flags)); - return val; -} - -static inline uint32_t set_cursor(uint32_t cursor) -{ - uint32_t old; - __asm__ __volatile__( - "int $0x40" - :"=a"(old) - :"a"(37), "b"(5), "c"(cursor)); - return old; -}; - -static inline int destroy_cursor(uint32_t cursor) -{ - int ret; - __asm__ __volatile__( - "int $0x40" - :"=a"(ret) - :"a"(37), "b"(6), "c"(cursor) - :"memory"); - return ret; -}; - - -static inline -uint32_t wait_for_event(uint32_t time) -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(23), "b"(time)); - return val; -}; - -static inline uint32_t check_os_event() -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(11)); - return val; -}; - -static inline uint32_t get_os_event() -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(10)); - return val; -}; - -static inline -uint32_t get_tick_count(void) -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(26),"b"(9)); - return val; -}; - -static inline -uint64_t get_ns_count(void) -{ - uint64_t val; - __asm__ __volatile__( - "int $0x40" - :"=A"(val) - :"a"(26), "b"(10)); - return val; -}; - -static inline -oskey_t get_key(void) -{ - oskey_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(2)); - return val; -} - -static inline -uint32_t get_os_button() -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(17)); - return val>>8; -}; - -static inline uint32_t get_service(char *name) -{ - uint32_t retval = 0; - __asm__ __volatile__( - "int $0x40" - :"=a"(retval) - :"a"(68),"b"(16),"c"(name) - :"memory"); - - return retval; -}; - -static inline int call_service(ioctl_t *io) -{ - int retval; - - __asm__ __volatile__( - "int $0x40" - :"=a"(retval) - :"a"(68),"b"(17),"c"(io) - :"memory","cc"); - - return retval; -}; - - -static inline void yield(void) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(68), "b"(1)); -}; - -static inline void delay(uint32_t time) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(5), "b"(time) - :"memory"); -}; - -static inline -void *user_alloc(size_t size) -{ - void *val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(68),"b"(12),"c"(size)); - return val; -} - -static inline -int user_free(void *mem) -{ - int val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(68),"b"(13),"c"(mem)); - return val; -} - -static inline -void* user_realloc(void *mem, size_t size) -{ - void *val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(68),"b"(20),"c"(size),"d"(mem) - :"memory"); - - return val; -}; - -static inline -int *user_unmap(void *base, size_t offset, size_t size) -{ - int *val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(68),"b"(26),"c"(base),"d"(offset),"S"(size)); - return val; -}; - -static inline ufile_t load_file(const char *path) -{ - ufile_t uf; - - __asm__ __volatile__ ( - "int $0x40" - :"=A"(uf.raw) - :"a" (68), "b"(27),"c"(path)); - - return uf; -}; - -static inline int GetScreenSize() -{ - int retval; - - __asm__ __volatile__( - "int $0x40" - :"=a"(retval) - :"a"(61), "b"(1)); - return retval; -} - - -static inline void get_proc_info(char *info) -{ - __asm__ __volatile__( - "int $0x40" - : - :"a"(9), "b"(info), "c"(-1) - :"memory"); -}; - -static inline void Blit(void *bitmap, int dst_x, int dst_y, - int src_x, int src_y, int w, int h, - int src_w, int src_h, int stride) -{ - volatile struct blit_call bc; - - bc.dstx = dst_x; - bc.dsty = dst_y; - bc.w = w; - bc.h = h; - bc.srcx = src_x; - bc.srcy = src_y; - bc.srcw = src_w; - bc.srch = src_h; - bc.stride = stride; - bc.bitmap = bitmap; - - __asm__ __volatile__( - "int $0x40" - ::"a"(73),"b"(0),"c"(&bc.dstx)); -}; - - -// newlib exclusive -#ifndef __TINYC__ -int create_thread(int (*proc)(void *param), void *param, int stack_size); - -void* load_library(const char *name); - -void* get_proc_address(void *handle, const char *proc_name); - -void enumerate_libraries(int (*callback)(void *handle, const char* name, - uint32_t base, uint32_t size, void *user_data), - void *user_data); -#endif - -// May be next section need to be added in newlibc - -enum KOLIBRI_GUI_EVENTS { - KOLIBRI_EVENT_NONE = 0, /* Event queue is empty */ - KOLIBRI_EVENT_REDRAW = 1, /* Window and window elements should be redrawn */ - KOLIBRI_EVENT_KEY = 2, /* A key on the keyboard was pressed */ - KOLIBRI_EVENT_BUTTON = 3, /* A button was clicked with the mouse */ - KOLIBRI_EVENT_DESKTOP = 5, /* Desktop redraw finished */ - KOLIBRI_EVENT_MOUSE = 6, /* Mouse activity (movement, button press) was detected */ - KOLIBRI_EVENT_IPC = 7, /* Interprocess communication notify */ - KOLIBRI_EVENT_NETWORK = 8, /* Network event */ - KOLIBRI_EVENT_DEBUG = 9, /* Debug subsystem event */ - KOLIBRI_EVENT_IRQBEGIN = 16 /* 16..31 IRQ0..IRQ15 interrupt =IRQBEGIN+IRQn */ -}; - - -// copied from /programs/system/shell/system/kolibri.c -// fn's returned -1 as syserror, 1 as error, 0 as OK -static inline -int kol_clip_num() -{ - register uint32_t val; - asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(0)); - return val; -} - -static inline -char* kol_clip_get(int n) -// returned buffer must be freed by user_free() -{ - register char* val; - asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(1), "c"(n)); - return val; -} - -static inline -int kol_clip_set(int n, char buffer[]) -{ - register uint32_t val; - asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(2), "c"(n), "d"(buffer)); - return val; -} - -static inline -int kol_clip_pop() -{ - register uint32_t val; - asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(3)); - return val; -} - -static inline -int kol_clip_unlock() -{ - register uint32_t val; - asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(4)); - return val; -} - -static inline void get_system_colors(struct kolibri_system_colors *color_table) -{ - __asm__ volatile ("int $0x40" - : - :"a"(48),"b"(3),"c"(color_table),"d"(40) - ); - - /* color_table should point to the system color table */ -} - -static inline void debug_board_write_byte(const char ch){ - __asm__ __volatile__( - "int $0x40" - : - :"a"(63), "b"(1), "c"(ch)); -} - - -static inline void draw_number_sys(int32_t number, int x, int y, int len, color_t color){ - register uint32_t fmt; - fmt = len << 16 | 0x80000000; // no leading zeros + width -// fmt = len << 16 | 0x00000000; // leading zeros + width - __asm__ __volatile__( - "int $0x40" - : - :"a"(47), "b"(fmt), "c"(number), "d"((x << 16) | y), "S"(color)); -} - -static inline -uint32_t get_mouse_eventstate(void) -{ - uint32_t val; - - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(37),"b"(3)); - return val; -}; - -static inline -uint32_t set_event_mask(uint32_t mask) -{ - register uint32_t val; - asm volatile ("int $0x40":"=a"(val):"a"(40), "b"(mask)); - return val; -} - -typedef void (*thread_proc)(void*); - -static inline -int start_thread(thread_proc proc, char* stack_top) -{ - register int val; - asm volatile ("int $0x40":"=a"(val):"a"(51), "b"(1), "c"(proc), "d"(stack_top)); - return val; -} - -static inline -void kos_exit() -{ - asm volatile ("int $0x40"::"a"(-1)); -} - -static inline void focus_window(int slot){ - asm volatile ("int $0x40"::"a"(18), "b"(3), "c"(slot)); -} - -static inline int get_thread_slot(int tid){ - register int val; - asm volatile ("int $0x40":"=a"(val):"a"(18), "b"(21), "c"(tid)); - return val; -} - -static inline void set_current_folder(char* dir){ - asm volatile ("int $0x40"::"a"(30), "b"(1), "c"(dir)); -} - -static inline int get_current_folder(char* buf, int bufsize){ - register int val; - asm volatile ("int $0x40":"=a"(val):"a"(30), "b"(2), "c"(buf), "d"(bufsize)); - return val; -} - -static inline -void ipc_set_area(void* buf, int bufsize){ - asm volatile ("int $0x40"::"a"(60), "b"(1), "c"(buf), "d"(bufsize)); -} - -static inline -int ipc_send_message(int pid_reciever, void *data, int datalen) { - register int val; - asm volatile ("int $0x40":"=a"(val):"a"(60), "b"(2), "c"(pid_reciever), "d"(data), "S"(datalen)); - return val; -} - -static inline -void* shm_open(char *shm_name, int msize, int flags, int *retsz){ - register int val, cod; - asm volatile ("int $0x40":"=a"(val),"=d"(cod):"a"(68), "b"(22), "c"(shm_name), "d"(msize), "S"(flags)); - - if(retsz) *retsz = cod; // errcode if NULL or memsize when open - return (void*)val; -} - -static inline -void shm_close(char *shm_name){ - asm volatile ("int $0x40"::"a"(68), "b"(23), "c"(shm_name)); -} - -static inline -int start_app(char *app_name, char *args){ - #pragma pack(push, 1) - struct file_op_t - { - uint32_t fn; - uint32_t flags; - char* args; - uint32_t res1, res2; - char zero; - char* app_name __attribute__((packed)); - } file_op; - #pragma pack(pop) - memset(&file_op, 0, sizeof(file_op)); - file_op.fn = 7; - file_op.args = args; - file_op.app_name = app_name; - - register int val; - asm volatile ("int $0x40":"=a"(val):"a"(70), "b"(&file_op)); - - return val; -} - - -/* -static inline char *getcwd(char *buf, size_t size) -{ - int rc = get_current_folder(buf, size); - if (rc > size) - { - errno = ERANGE; - return 0; - } - else - return buf; -} -*/ -// end section - - - -//added nonstatic inline because incomfortabre stepping in in debugger -void __attribute__ ((noinline)) debug_board_write_str(const char* str); -void __attribute__ ((noinline)) debug_board_printf(const char *format,...); - -/* copy body to only one project file -void __attribute__ ((noinline)) debug_board_write_str(const char* str){ - while(*str) - debug_board_write_byte(*str++); -} - -void __attribute__ ((noinline)) debug_board_printf(const char *format,...) -{ - va_list ap; - char log_board[300]; - - va_start (ap, format); - vsnprintf(log_board, sizeof log_board, format, ap); - va_end(ap); - debug_board_write_str(log_board); -} -*/ - - - -// TinyC don't support aliasing of static inline funcs -#ifndef __TINYC__ -static inline void BeginDraw(void) __attribute__ ((alias ("begin_draw"))); -static inline void EndDraw(void) __attribute__ ((alias ("end_draw"))); -static inline void DrawWindow(int x, int y, int w, int h, const char *name, - color_t workcolor, uint32_t style) - __attribute__ ((alias ("sys_create_window"))); -static inline void DefineButton(void) __attribute__ ((alias ("define_button"))); -static inline void DrawLine(int xs, int ys, int xe, int ye, color_t color) - __attribute__ ((alias ("draw_line"))); -static inline void DrawBar(int x, int y, int w, int h, color_t color) - __attribute__ ((alias ("draw_bar"))); -static inline void DrawBitmap(void *bitmap, int x, int y, int w, int h) - __attribute__ ((alias ("draw_bitmap"))); -static inline uint32_t GetSkinHeight(void) __attribute__ ((alias ("get_skin_height"))); -static inline pos_t GetMousePos(int origin) __attribute__ ((alias ("get_mouse_pos"))); -static inline uint32_t GetMouseButtons(void) __attribute__ ((alias ("get_mouse_buttons"))); -static inline uint32_t GetMouseWheels(void) __attribute__ ((alias ("get_mouse_wheels"))); -static inline uint32_t LoadCursor(void *path, uint32_t flags) __attribute__ ((alias ("load_cursor"))); -static inline uint32_t SetCursor(uint32_t cursor) __attribute__ ((alias ("set_cursor"))); -static inline int DestroyCursor(uint32_t cursor) __attribute__ ((alias ("destroy_cursor"))); -static inline uint32_t GetOsEvent(void) __attribute__ ((alias ("get_os_event"))); -static inline void *UserAlloc(size_t size) __attribute__ ((alias ("user_alloc"))); -static inline int UserFree(void *mem) __attribute__ ((alias ("user_free"))); -static inline void* UserRealloc(void *mem, size_t size) __attribute__ ((alias ("user_realloc"))); -static inline int *UserUnmap(void *base, size_t offset, size_t size) __attribute__ ((alias ("user_unmap"))); -static inline ufile_t LoadFile(const char *path) __attribute__ ((alias ("load_file"))); -static inline void GetProcInfo(char *info) __attribute__ ((alias ("get_proc_info"))); -#endif - -#ifdef __cplusplus -} -#endif - - -#endif - - - - - diff --git a/programs/other/TinyHashView/notify.h b/programs/other/TinyHashView/notify.h deleted file mode 100644 index bb97dbb5f1..0000000000 --- a/programs/other/TinyHashView/notify.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "kos32sys.h" -void notify_show(char *text) -{ - start_app("/sys/@notify", text); -} diff --git a/programs/other/TinyHashView/thashview.c b/programs/other/TinyHashView/thashview.c index 09ba1421cc..0986e3f4fb 100644 --- a/programs/other/TinyHashView/thashview.c +++ b/programs/other/TinyHashView/thashview.c @@ -1,19 +1,18 @@ /*Автор: Логаев Максим(turbocat2001) */ #include #include -#include "kos32sys.h" -#include "notify.h" +#include #include #include -#include "algorithms/md5.h" -#include "algorithms/sha1.h" -#include "algorithms/sha256.h" +#include +#include +#include #define TRUE 1; #define FALSE 0; #define MAX_HASH_LEN 65 // Максимальная длина строки #define WINDOW_W 665 -#define VERSION "%s - thashview 2.3" +#define VERSION "%s - thashview 2.4" typedef unsigned char bool; struct kolibri_system_colors sys_color_table; @@ -59,7 +58,10 @@ enum BUTTONS // BTN_PASTE=50 //Вставить в edit_box(пока в разработке) }; - +void notify_show(char *text) +{ + start_app("/sys/@notify", text); +} void* safe_malloc(size_t size) // Безопасный malloc. Показывает уведомление об ошибке и закрывает программу если память не была выделена { @@ -173,7 +175,7 @@ void redraw_window() // draw_bar(10, 121, 525,20, WHITE); // Создаём прямоугольник для поля ввода draw_text_sys(edit_box_buff,15, 125, 0, 0x90000000| edit_box_text_color); // Выводим текст из буффера ввода - draw_text_sys("|",10+(8*str_pos),125,0,0x90000000 | sys_color_table.work_text); + draw_text_sys("|",10+(8*str_pos),125,0,0x90000000 | BLACK); define_button((10 << 16) + 60, (30 << 16) + 20, BTN_MD5, GREEN); // Определяем кнопку md5 define_button((10 << 16) + 60, (60 << 16) + 20, BTN_SHA1, GREEN);// Определяем кнопку sha1 @@ -300,7 +302,7 @@ bool hash_compare() // void edit_box(oskey_t key) //Функция реализующая строку ввода { - edit_box_text_color=sys_color_table.frame_area; + edit_box_text_color=BLACK; if(key.code==CTRL_V) // Если нажато Ctrl+V то вставить из буфера обмена { paste_to_edit_buffer();