bkcrack: include/bkcrack/types.hpp File Reference

bkcrack 1.8.1 Crack legacy zip encryption with Biham and Kocher's known plaintext attack.

types.hpp File Reference

Useful types, constants and utility functions. More...

`#include <array>`
`#include <cstdint>`
`#include <stdexcept>`
`#include <string>`
`#include <vector>`
Include dependency graph for types.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
class | BaseError
| Base exception type. More...

## Functions
constexpr auto | lsb (std::uint32_t x) -> std::uint8_t
constexpr auto | msb (std::uint32_t x) -> std::uint8_t

## Variables
template<int begin, int end>
constexpr auto | mask = std::uint32_t{~0u << begin & ~0u >> (32 - end)}
| Constant value for bit masking.
template<int x>
constexpr auto | maxdiff = std::uint32_t{mask<0, x> + 0xff}
| Maximum difference between 32-bits integers A and B[x,32) knowing that A = B + b and b is a byte.

## Detailed Description

Useful types, constants and utility functions.

## Function Documentation

## ◆ lsb()

auto lsb | ( | std::uint32_t | x | ) | -> std::uint8_t
| constexpr

Returns
  the least significant byte of x

## ◆ msb()

auto msb | ( | std::uint32_t | x | ) | -> std::uint8_t
| constexpr

Returns
  the most significant byte of x

## Variable Documentation

## ◆ maxdiff

template<int x>

auto maxdiff = std::uint32_t{mask<0, x> + 0xff}
| constexpr

Maximum difference between 32-bits integers A and B[x,32) knowing that A = B + b and b is a byte.

The following equations show how the difference is bounded by the given constants:

    A = B + b
    A = B[0,x) + B[x,32) + b
    A - B[x,32) = B[0,x) + b
    A - B[x,32) <= 0xffffffff[0,x) + 0xff