sha1: give state enum a print operator
This commit is contained in:
parent
ca9db30ab4
commit
a9bffcff08
@ -37,6 +37,19 @@ using std::begin;
|
|||||||
using std::end;
|
using std::end;
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
std::ostream&
|
||||||
|
operator<< (std::ostream &os, SHA1::state_t t) {
|
||||||
|
switch (t) {
|
||||||
|
case SHA1::READY: os << "READY"; return os;
|
||||||
|
case SHA1::FINISHED: os << "FINISHED"; return os;
|
||||||
|
default:
|
||||||
|
unreachable ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
// Logical function for sequence of rounds
|
// Logical function for sequence of rounds
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
f_00 (uint32_t B, uint32_t C, uint32_t D)
|
f_00 (uint32_t B, uint32_t C, uint32_t D)
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
* terms of the GNU General Public License as published by the Free Software
|
* terms of the GNU General Public License as published by the Free Software
|
||||||
* Foundation, either version 3 of the License, or (at your option) any later
|
* Foundation, either version 3 of the License, or (at your option) any later
|
||||||
* version.
|
* version.
|
||||||
*
|
*
|
||||||
* libgim is distributed in the hope that it will be useful, but WITHOUT ANY
|
* libgim is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with libgim. If not, see <http://www.gnu.org/licenses/>.
|
* along with libgim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
@ -40,17 +40,19 @@ namespace util {
|
|||||||
digest_t digest (void) const;
|
digest_t digest (void) const;
|
||||||
void reset (void);
|
void reset (void);
|
||||||
|
|
||||||
|
enum state_t {
|
||||||
|
READY,
|
||||||
|
FINISHED
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void process (void);
|
void process (void);
|
||||||
|
|
||||||
enum {
|
state_t state;
|
||||||
READY,
|
|
||||||
FINISHED
|
|
||||||
} state;
|
|
||||||
|
|
||||||
uint64_t total;
|
uint64_t total;
|
||||||
uint32_t H[5];
|
uint32_t H[5];
|
||||||
|
|
||||||
union {
|
union {
|
||||||
uint8_t c[16*4+64*4];
|
uint8_t c[16*4+64*4];
|
||||||
uint32_t W[16 +64 ];
|
uint32_t W[16 +64 ];
|
||||||
|
Loading…
Reference in New Issue
Block a user