From 96d6eb6f29c55e16a37cf11899547886f735b065 Mon Sep 17 00:00:00 2001 From: lloyd Date: Mon, 30 Mar 2009 18:27:18 +0000 Subject: Thomas Moschny passed along a request from the Fedora packagers which came up during the Fedora submission review, that each source file include some text about the license. One handy Perl script later and each file now has the line Distributed under the terms of the Botan license after the copyright notices. While I was in there modifying every file anyway, I also stripped out the remainder of the block comments (lots of astericks before and after the text); this is stylistic thing I picked up when I was first learning C++ but in retrospect it is not a good style as the structure makes it harder to modify comments (with the result that comments become fewer, shorter and are less likely to be updated, which are not good things). --- src/codec/hex/hex.cpp | 88 ++++++++++++++++++++++++---------------------- src/codec/hex/hex.h | 10 +++--- src/codec/hex/hex_char.cpp | 22 ++++++------ 3 files changed, 63 insertions(+), 57 deletions(-) (limited to 'src/codec/hex') diff --git a/src/codec/hex/hex.cpp b/src/codec/hex/hex.cpp index 4cbc1d37b..fbacc278b 100644 --- a/src/codec/hex/hex.cpp +++ b/src/codec/hex/hex.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Hex Encoder/Decoder Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Hex Encoder/Decoder +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include #include @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Hex_Encoder Constructor * -*************************************************/ +/* +* Hex_Encoder Constructor +*/ Hex_Encoder::Hex_Encoder(bool breaks, u32bit length, Case c) : casing(c), line_length(breaks ? length : 0) { @@ -22,9 +24,9 @@ Hex_Encoder::Hex_Encoder(bool breaks, u32bit length, Case c) : counter = position = 0; } -/************************************************* -* Hex_Encoder Constructor * -*************************************************/ +/* +* Hex_Encoder Constructor +*/ Hex_Encoder::Hex_Encoder(Case c) : casing(c), line_length(0) { in.create(64); @@ -32,9 +34,9 @@ Hex_Encoder::Hex_Encoder(Case c) : casing(c), line_length(0) counter = position = 0; } -/************************************************* -* Hex Encoding Operation * -*************************************************/ +/* +* Hex Encoding Operation +*/ void Hex_Encoder::encode(byte in, byte out[2], Hex_Encoder::Case casing) { const byte* BIN_TO_HEX = ((casing == Uppercase) ? BIN_TO_HEX_UPPER : @@ -44,9 +46,9 @@ void Hex_Encoder::encode(byte in, byte out[2], Hex_Encoder::Case casing) out[1] = BIN_TO_HEX[((in ) & 0x0F)]; } -/************************************************* -* Encode and send a block * -*************************************************/ +/* +* Encode and send a block +*/ void Hex_Encoder::encode_and_send(const byte block[], u32bit length) { for(u32bit j = 0; j != length; ++j) @@ -73,9 +75,9 @@ void Hex_Encoder::encode_and_send(const byte block[], u32bit length) } } -/************************************************* -* Convert some data into hex format * -*************************************************/ +/* +* Convert some data into hex format +*/ void Hex_Encoder::write(const byte input[], u32bit length) { in.copy(position, input, length); @@ -96,9 +98,9 @@ void Hex_Encoder::write(const byte input[], u32bit length) position += length; } -/************************************************* -* Flush buffers * -*************************************************/ +/* +* Flush buffers +*/ void Hex_Encoder::end_msg() { encode_and_send(in, position); @@ -107,9 +109,9 @@ void Hex_Encoder::end_msg() counter = position = 0; } -/************************************************* -* Hex_Decoder Constructor * -*************************************************/ +/* +* Hex_Decoder Constructor +*/ Hex_Decoder::Hex_Decoder(Decoder_Checking c) : checking(c) { in.create(64); @@ -117,17 +119,17 @@ Hex_Decoder::Hex_Decoder(Decoder_Checking c) : checking(c) position = 0; } -/************************************************* -* Check if a character is a valid hex char * -*************************************************/ +/* +* Check if a character is a valid hex char +*/ bool Hex_Decoder::is_valid(byte in) { return (HEX_TO_BIN[in] != 0x80); } -/************************************************* -* Handle processing an invalid character * -*************************************************/ +/* +* Handle processing an invalid character +*/ void Hex_Decoder::handle_bad_char(byte c) { if(checking == NONE) @@ -140,17 +142,17 @@ void Hex_Decoder::handle_bad_char(byte c) to_string(c)); } -/************************************************* -* Hex Decoding Operation * -*************************************************/ +/* +* Hex Decoding Operation +*/ byte Hex_Decoder::decode(const byte hex[2]) { return ((HEX_TO_BIN[hex[0]] << 4) | HEX_TO_BIN[hex[1]]); } -/************************************************* -* Decode and send a block * -*************************************************/ +/* +* Decode and send a block +*/ void Hex_Decoder::decode_and_send(const byte block[], u32bit length) { for(u32bit j = 0; j != length / 2; ++j) @@ -158,9 +160,9 @@ void Hex_Decoder::decode_and_send(const byte block[], u32bit length) send(out, length / 2); } -/************************************************* -* Convert some data from hex format * -*************************************************/ +/* +* Convert some data from hex format +*/ void Hex_Decoder::write(const byte input[], u32bit length) { for(u32bit j = 0; j != length; ++j) @@ -177,9 +179,9 @@ void Hex_Decoder::write(const byte input[], u32bit length) } } -/************************************************* -* Flush buffers * -*************************************************/ +/* +* Flush buffers +*/ void Hex_Decoder::end_msg() { decode_and_send(in, position); diff --git a/src/codec/hex/hex.h b/src/codec/hex/hex.h index bb98c8770..035bf4ef9 100644 --- a/src/codec/hex/hex.h +++ b/src/codec/hex/hex.h @@ -1,7 +1,9 @@ -/************************************************* -* Hex Encoder/Decoder Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Hex Encoder/Decoder +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_HEX_H__ #define BOTAN_HEX_H__ diff --git a/src/codec/hex/hex_char.cpp b/src/codec/hex/hex_char.cpp index d34614a10..c28efc5f7 100644 --- a/src/codec/hex/hex_char.cpp +++ b/src/codec/hex/hex_char.cpp @@ -1,15 +1,17 @@ -/************************************************* -* Hex Character Table * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Hex Character Table +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include namespace Botan { -/************************************************* -* Hex Encoder Lookup Tables * -*************************************************/ +/* +* Hex Encoder Lookup Tables +*/ const byte Hex_Encoder::BIN_TO_HEX_UPPER[16] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }; @@ -18,9 +20,9 @@ const byte Hex_Encoder::BIN_TO_HEX_LOWER[16] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66 }; -/************************************************* -* Hex Decoder Lookup Table * -*************************************************/ +/* +* Hex Decoder Lookup Table +*/ const byte Hex_Decoder::HEX_TO_BIN[256] = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -- cgit v1.2.3