JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::BlowFish Class Reference

BlowFish encryption class. More...

#include <juce_BlowFish.h>

Collaboration diagram for juce::BlowFish:

Public Member Functions

 BlowFish (const BlowFish &)
 Creates a copy of another blowfish object. More...
 
 BlowFish (const void *keyData, int keyBytes)
 Creates an object that can encode/decode based on the specified key. More...
 
 ~BlowFish () noexcept
 Destructor. More...
 
void decrypt (MemoryBlock &data) const
 Decrypts a memory block. More...
 
void decrypt (uint32 &data1, uint32 &data2) const noexcept
 Decrypts a pair of 32-bit integers. More...
 
int decrypt (void *buffer, size_t bytes) const noexcept
 Decrypts data in-place. More...
 
void encrypt (MemoryBlock &data) const
 Encrypts a memory block. More...
 
void encrypt (uint32 &data1, uint32 &data2) const noexcept
 Encrypts a pair of 32-bit integers. More...
 
int encrypt (void *buffer, size_t sizeOfMsg, size_t bufferSize) const noexcept
 Encrypts data in-place. More...
 
BlowFishoperator= (const BlowFish &) noexcept
 Copies another blowfish object. More...
 

Private Member Functions

bool apply (void *, size_t, void(BlowFish::*op)(uint32 &, uint32 &) const) const
 
uint32 F (uint32) const noexcept
 

Static Private Member Functions

static int pad (void *, size_t, size_t) noexcept
 
static int unpad (const void *, size_t) noexcept
 

Private Attributes

uint32 p [18]
 
HeapBlock< uint32s [4]
 

Detailed Description

BlowFish encryption class.

@tags{Cryptography}

Constructor & Destructor Documentation

◆ BlowFish() [1/2]

juce::BlowFish::BlowFish ( const void *  keyData,
int  keyBytes 
)

Creates an object that can encode/decode based on the specified key.

The key data can be up to 72 bytes long.

◆ BlowFish() [2/2]

juce::BlowFish::BlowFish ( const BlowFish )

Creates a copy of another blowfish object.

◆ ~BlowFish()

juce::BlowFish::~BlowFish ( )
noexcept

Destructor.

Member Function Documentation

◆ apply()

bool juce::BlowFish::apply ( void *  ,
size_t  ,
void(BlowFish::*)(uint32 &, uint32 &) const  op 
) const
private

◆ decrypt() [1/3]

void juce::BlowFish::decrypt ( MemoryBlock data) const

Decrypts a memory block.

◆ decrypt() [2/3]

void juce::BlowFish::decrypt ( uint32 data1,
uint32 data2 
) const
noexcept

Decrypts a pair of 32-bit integers.

◆ decrypt() [3/3]

int juce::BlowFish::decrypt ( void *  buffer,
size_t  bytes 
) const
noexcept

Decrypts data in-place.

Parameters
bufferThe encrypted data that should be decrypted
bytesThe size of the encrypted data in bytes
Returns
The size of the decrypted data in bytes or -1 if the decryption failed.

◆ encrypt() [1/3]

void juce::BlowFish::encrypt ( MemoryBlock data) const

Encrypts a memory block.

◆ encrypt() [2/3]

void juce::BlowFish::encrypt ( uint32 data1,
uint32 data2 
) const
noexcept

Encrypts a pair of 32-bit integers.

◆ encrypt() [3/3]

int juce::BlowFish::encrypt ( void *  buffer,
size_t  sizeOfMsg,
size_t  bufferSize 
) const
noexcept

Encrypts data in-place.

Parameters
bufferThe message that should be encrypted. See bufferSize on size requirements!
sizeOfMsgThe size of the message that should be encrypted in bytes
bufferSizeThe size of the buffer in bytes. To accommodate the encrypted data, the buffer must be larger than the message: the size of the buffer needs to be equal or greater than the size of the message in bytes rounded to the next integer which is divisible by eight. If the message size in bytes is already divisible by eight then you need to add eight bytes to the buffer size. If in doubt simply use bufferSize = sizeOfMsg + 8.
Returns
The size of the decrypted data in bytes or -1 if the decryption failed.

◆ F()

uint32 juce::BlowFish::F ( uint32  ) const
privatenoexcept

◆ operator=()

BlowFish& juce::BlowFish::operator= ( const BlowFish )
noexcept

Copies another blowfish object.

◆ pad()

static int juce::BlowFish::pad ( void *  ,
size_t  ,
size_t   
)
staticprivatenoexcept

◆ unpad()

static int juce::BlowFish::unpad ( const void *  ,
size_t   
)
staticprivatenoexcept

Member Data Documentation

◆ p

uint32 juce::BlowFish::p[18]
private

◆ s

HeapBlock<uint32> juce::BlowFish::s[4]
private

The documentation for this class was generated from the following file: