feisty meow concerns codebase 2.140
borked_blowfish_crypto.cpp
Go to the documentation of this file.
1/*
2* Name : borked_blowfish_crypto
3* Author : Chris Koeritz
4*****
5* Copyright (c) 2005-$now By Author. This program is free software; you can
6* redistribute it and/or modify it under the terms of the GNU General Public
7* License as published by the Free Software Foundation; either version 2 of
8* the License or (at your option) any later version. This is online at:
9* http://www.fsf.org/copyleft/gpl.html
10* Please send any updates to: fred@gruntose.com
11*/
12
14#include "ssl_init.h"
15
16#include <basis/astring.h>
17#include <basis/functions.h>
18#include <basis/mutex.h>
21#include <mathematics/chaos.h>
23
24#include <openssl/err.h>
25#include <openssl/evp.h>
26
27using namespace basis;
28using namespace loggers;
29using namespace mathematics;
30using namespace structures;
31
32namespace crypto {
33
34//#define DEBUG_BLOWFISH
35 // uncomment for noisier version.
36#undef ALWAYS_LOG
37#define ALWAYS_LOG(t) CLASS_EMERGENCY_LOG(program_wide_logger::get(), t)
38#ifdef DEBUG_BLOWFISH
39 #undef LOG
40 #define LOG(t) CLASS_EMERGENCY_LOG(program_wide_logger::get(), t)
41#else
42 #undef LOG
43 #define LOG(t)
44#endif
45
51
53: cryptical_envelopment(EVP_bf_cbc())
54{
55 set_key(key, key_size);
56}
57
63
67
69{
70 if (this == &to_copy) return *this;
71 *((cryptical_envelopment *)this) = *((cryptical_envelopment *)&to_copy);
72//hmmm: is that the best way to do this?
73 return *this;
74}
75
76} //namespace.
77
A very common template for a dynamic array of bytes.
Definition byte_array.h:36
borked_blowfish_crypto & operator=(const borked_blowfish_crypto &to_copy)
borked_blowfish_crypto(int key_size)
this will create a new random key of the "key_size", in bits.
bool set_key(int key_size)
this will create a new random key of the "key_size", in bits.
The guards collection helps in testing preconditions and reporting errors.
Definition array.h:30
A logger that sends to the console screen using the standard output device.
An extension to floating point primitives providing approximate equality.
Definition averager.h:21
A dynamic container class that holds any kind of object via pointers.
Definition amorph.h:55