libenigma
Enigma machine utility library
Loading...
Searching...
No Matches
score.h File Reference
#include "enigma.h"

Go to the source code of this file.

Data Structures

struct  EnigmaScore
 A structure representing a scored Enigma configuration. More...
 
struct  EnigmaScoreList
 A structure representing a list of scored Enigma configurations. More...
 

Macros

#define ENIGMA_FLAG_DICTIONARY_MATCH   1
 Flag indicating that an analyzed configuration should, or does, have at least two dictionary word matches.
 
#define ENIGMA_FLAG_FREQUENCY   2
 Flag indicating that an analyzed configuration should, or does, fall within a certain letter frequency range.
 
#define ENIGMA_FLAG_KNOWN_PLAINTEXT   4
 Flag indicating that an analyzed configuration should, or does, contain known plaintext.
 

Functions

int enigma_score_print (const EnigmaScoreList *)
 Print the scores in an EnigmaScoreList.
 
int enigma_score_list_sort (EnigmaScoreList *)
 Sort an array of EnigmaScore by score in descending order.
 
Enigmaenigma_score_get_enigma (EnigmaScore *)
 Get the enigma field in the given EnigmaScore.
 
float enigma_score_get_score (EnigmaScore *)
 Get the score field in the given EnigmaScore.
 
int enigma_score_get_flags (EnigmaScore *)
 Get the flags field in the given EnigmaScore.
 
int enigma_score_set_enigma (EnigmaScore *, Enigma *)
 Set the enigma field in the given EnigmaScore.
 
int enigma_score_set_score (EnigmaScore *, float)
 Set the score field in the given EnigmaScore.
 
int enigma_score_set_flags (EnigmaScore *, int)
 Set the flags field in the given EnigmaScore.
 
EnigmaScoreenigma_score_list_get_scores (EnigmaScoreList *)
 Get the scores array from the given EnigmaScoreList.
 
EnigmaScoreenigma_score_list_get_score (EnigmaScoreList *, int)
 Get the score at the given index from the given EnigmaScoreList.
 
int enigma_score_list_get_score_count (EnigmaScoreList *)
 Get the score count from the given EnigmaScoreList.
 
int enigma_score_list_get_max_scores (EnigmaScoreList *)
 Get the maximum number of scores from the given EnigmaScoreList.
 
int enigma_score_list_set_score (EnigmaScoreList *, int, EnigmaScore *)
 Set the score at the given index in the given EnigmaScoreList.
 
int enigma_score_list_set_score_count (EnigmaScoreList *, int)
 Set the score count in the given EnigmaScoreList.
 
int enigma_score_list_set_max_scores (EnigmaScoreList *, int)
 Set the maximum number of scores in the given EnigmaScoreList.
 

Detailed Description

This file contains function definitions related to plaintext scoring.

Macro Definition Documentation

◆ ENIGMA_FLAG_DICTIONARY_MATCH

#define ENIGMA_FLAG_DICTIONARY_MATCH   1

Flag indicating that an analyzed configuration should, or does, have at least two dictionary word matches.

◆ ENIGMA_FLAG_FREQUENCY

#define ENIGMA_FLAG_FREQUENCY   2

Flag indicating that an analyzed configuration should, or does, fall within a certain letter frequency range.

◆ ENIGMA_FLAG_KNOWN_PLAINTEXT

#define ENIGMA_FLAG_KNOWN_PLAINTEXT   4

Flag indicating that an analyzed configuration should, or does, contain known plaintext.

Function Documentation

◆ enigma_score_get_enigma()

Enigma * enigma_score_get_enigma ( EnigmaScore score)

Get the enigma field in the given EnigmaScore.

Parameters
scoreThe EnigmaScore instance
Returns
The enigma field, or NULL if score is NULL

◆ enigma_score_get_flags()

int enigma_score_get_flags ( EnigmaScore score)

Get the flags field in the given EnigmaScore.

Parameters
scoreThe EnigmaScore instance
Returns
The flags field, or ENIGMA_FAILURE if score is NULL

◆ enigma_score_get_score()

float enigma_score_get_score ( EnigmaScore score)

Get the score field in the given EnigmaScore.

Parameters
scoreThe EnigmaScore instance
Returns
The score field, or ENIGMA_FAILURE if score is NULL

◆ enigma_score_list_get_max_scores()

int enigma_score_list_get_max_scores ( EnigmaScoreList list)

Get the maximum number of scores from the given EnigmaScoreList.

Parameters
listThe EnigmaScoreList instance
Returns
int The maximum number of scores

◆ enigma_score_list_get_score()

EnigmaScore * enigma_score_list_get_score ( EnigmaScoreList list,
int  index 
)

Get the score at the given index from the given EnigmaScoreList.

Parameters
listThe EnigmaScoreList instance
indexThe index of the score to get
Returns
EnigmaScore* The score at the given index

◆ enigma_score_list_get_score_count()

int enigma_score_list_get_score_count ( EnigmaScoreList list)

Get the score count from the given EnigmaScoreList.

Parameters
listThe EnigmaScoreList instance
Returns
int The score count

◆ enigma_score_list_get_scores()

EnigmaScore * enigma_score_list_get_scores ( EnigmaScoreList list)

Get the scores array from the given EnigmaScoreList.

Parameters
listThe EnigmaScoreList instance
Returns
EnigmaScore* The scores array

◆ enigma_score_list_set_max_scores()

int enigma_score_list_set_max_scores ( EnigmaScoreList list,
int  max 
)

Set the maximum number of scores in the given EnigmaScoreList.

Parameters
listThe EnigmaScoreList instance
maxThe new maximum number of scores
Returns
ENIGMA_SUCCESS on success, ENIGMA_FAILURE on failure

◆ enigma_score_list_set_score()

int enigma_score_list_set_score ( EnigmaScoreList list,
int  index,
EnigmaScore score 
)

Set the score at the given index in the given EnigmaScoreList.

Parameters
listThe EnigmaScoreList instance
indexThe index of the score to set
scoreThe EnigmaScore instance to set
Returns
ENIGMA_SUCCESS on success, ENIGMA_FAILURE on failure

◆ enigma_score_list_set_score_count()

int enigma_score_list_set_score_count ( EnigmaScoreList list,
int  count 
)

Set the score count in the given EnigmaScoreList.

Parameters
listThe EnigmaScoreList instance
countThe new score count
Returns
ENIGMA_SUCCESS on success, ENIGMA_FAILURE on failure

◆ enigma_score_list_sort()

int enigma_score_list_sort ( EnigmaScoreList list)

Sort an array of EnigmaScore by score in descending order.

Parameters
listThe array of EnigmaScore to sort.
Returns
ENIGMA_SUCCESS on success, ENIGMA_FAILURE on failure.

◆ enigma_score_print()

int enigma_score_print ( const EnigmaScoreList list)

Print the scores in an EnigmaScoreList.

Parameters
listPointer to the EnigmaScoreList structure.
Returns
ENIGMA_SUCCESS on success, or ENIGMA_FAILURE on failure.

◆ enigma_score_set_enigma()

int enigma_score_set_enigma ( EnigmaScore score,
Enigma enigma 
)

Set the enigma field in the given EnigmaScore.

Parameters
scoreThe EnigmaScore instance
enigmaThe Enigma instance to set
Returns
ENIGMA_SUCCESS on success, ENIGMA_FAILURE on failure

◆ enigma_score_set_flags()

int enigma_score_set_flags ( EnigmaScore score,
int  flags 
)

Set the flags field in the given EnigmaScore.

Parameters
scoreThe EnigmaScore instance
flagsThe flags value to set
Returns
ENIGMA_SUCCESS on success, ENIGMA_FAILURE on failure

◆ enigma_score_set_score()

int enigma_score_set_score ( EnigmaScore score,
float  value 
)

Set the score field in the given EnigmaScore.

Parameters
scoreThe EnigmaScore instance
valueThe score value to set
Returns
ENIGMA_SUCCESS on success, ENIGMA_FAILURE on failure