ekg2  GIT master
Struktury danych | Definicje | Definicje typów | Funkcje | Zmienne
Dokumentacja pliku digest.c
#include "ekg2.h"
#include "jabber.h"
#include <stdio.h>
#include <string.h>
Wykres zależności załączania dla digest.c:

Struktury danych

struct  EKG2_SHA1_CTX
 

Definicje

#define LITTLE_ENDIAN
 
#define SHA1HANDSOFF
 
#define SHA1Init(ctx)   Init(ctx, 1)
 
#define SHA1Transform(state, buffer)   Transform(state, buffer, 1)
 
#define SHA1Update(ctx, data, len)   Update(ctx, (unsigned char *) data, len, 1)
 
#define SHA1Final(digest, ctx)   Final(digest, ctx, 1)
 
#define MD5Init(ctx)   Init(ctx, 0)
 
#define MD5Transform(state, buffer)   Transform(state, buffer, 0)
 
#define MD5Update(ctx, data, len)   Update(ctx, (unsigned char *) data, len, 0)
 
#define MD5Final(digest, ctx)   Final(digest, ctx, 0)
 
#define rol(value, bits)   (((value) << (bits)) | ((value) >> (32 - (bits))))
 
#define blk0(i)
 
#define blk(i)
 
#define R0(v, w, x, y, z, i)   z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
 
#define R1(v, w, x, y, z, i)   z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
 
#define R2(v, w, x, y, z, i)   z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
 
#define R3(v, w, x, y, z, i)   z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
 
#define R4(v, w, x, y, z, i)   z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
 
#define F(x, y, z)   (((x) & (y)) | ((~x) & (z)))
 
#define G(x, y, z)   (((x) & (z)) | ((y) & (~z)))
 
#define H(x, y, z)   ((x) ^ (y) ^ (z))
 
#define I(x, y, z)   ((y) ^ ((x) | (~z)))
 
#define FF(a, b, c, d, x, s, ac)   { (a) += F ((b), (c), (d)) + (x) + (guint32)(ac); (a) = rol((a), (s)); (a) += (b); }
 
#define GG(a, b, c, d, x, s, ac)   { (a) += G ((b), (c), (d)) + (x) + (guint32)(ac); (a) = rol((a), (s)); (a) += (b); }
 
#define HH(a, b, c, d, x, s, ac)   { (a) += H ((b), (c), (d)) + (x) + (guint32)(ac); (a) = rol((a), (s)); (a) += (b); }
 
#define II(a, b, c, d, x, s, ac)   { (a) += I ((b), (c), (d)) + (x) + (guint32)(ac); (a) = rol((a), (s)); (a) += (b); }
 
#define S11   7
 
#define S12   12
 
#define S13   17
 
#define S14   22
 
#define S21   5
 
#define S22   9
 
#define S23   14
 
#define S24   20
 
#define S31   4
 
#define S32   11
 
#define S33   16
 
#define S34   23
 
#define S41   6
 
#define S42   10
 
#define S43   15
 
#define S44   21
 

Definicje typów

typedef struct EKG2_SHA1_CTX EKG2_MD5_CTX
 

Funkcje

static void Init (EKG2_SHA1_CTX *context, int usesha)
 
static void Transform (guint32 state[5], unsigned char buffer[64], int usesha)
 
static void Update (EKG2_SHA1_CTX *context, unsigned char *data, unsigned int len, int usesha)
 
static void Final (unsigned char digest[20], EKG2_SHA1_CTX *context, int usesha)
 
static void Encode (unsigned char *output, guint32 *input, unsigned int len, int usesha)
 
static char * base16_encode (const unsigned char *data)
 
char * jabber_challenge_digest (const char *sid, const char *password, const char *nonce, const char *cnonce, const char *xmpp_temp, const char *realm)
 
char * jabber_dcc_digest (char *sid, char *initiator, char *target)
 
char * jabber_digest (const char *sid, const char *password, int istlen)
 
char * jabber_sha1_generic (char *buf, int len)
 

Zmienne

char * config_console_charset
 

Dokumentacja definicji

◆ blk

#define blk (   i)
Wartość:
(block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
^block->l[(i+2)&15]^block->l[i&15],1))
int i
Definition: ekg_hash_benchmark.c:110
#define rol(value, bits)
Definition: digest.c:79

◆ blk0

#define blk0 (   i)
Wartość:
(block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|(rol(block->l[i],8)&0x00FF00FF))
int i
Definition: ekg_hash_benchmark.c:110
#define rol(value, bits)
Definition: digest.c:79

◆ F

#define F (   x,
  y,
 
)    (((x) & (y)) | ((~x) & (z)))

◆ FF

#define FF (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)    { (a) += F ((b), (c), (d)) + (x) + (guint32)(ac); (a) = rol((a), (s)); (a) += (b); }

◆ G

#define G (   x,
  y,
 
)    (((x) & (z)) | ((y) & (~z)))

◆ GG

#define GG (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)    { (a) += G ((b), (c), (d)) + (x) + (guint32)(ac); (a) = rol((a), (s)); (a) += (b); }

◆ H

#define H (   x,
  y,
 
)    ((x) ^ (y) ^ (z))

◆ HH

#define HH (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)    { (a) += H ((b), (c), (d)) + (x) + (guint32)(ac); (a) = rol((a), (s)); (a) += (b); }

◆ I

#define I (   x,
  y,
 
)    ((y) ^ ((x) | (~z)))

◆ II

#define II (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)    { (a) += I ((b), (c), (d)) + (x) + (guint32)(ac); (a) = rol((a), (s)); (a) += (b); }

◆ LITTLE_ENDIAN

#define LITTLE_ENDIAN

◆ MD5Final

#define MD5Final (   digest,
  ctx 
)    Final(digest, ctx, 0)

◆ MD5Init

#define MD5Init (   ctx)    Init(ctx, 0)

◆ MD5Transform

#define MD5Transform (   state,
  buffer 
)    Transform(state, buffer, 0)

◆ MD5Update

#define MD5Update (   ctx,
  data,
  len 
)    Update(ctx, (unsigned char *) data, len, 0)

◆ R0

#define R0 (   v,
  w,
  x,
  y,
  z,
  i 
)    z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);

◆ R1

#define R1 (   v,
  w,
  x,
  y,
  z,
  i 
)    z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);

◆ R2

#define R2 (   v,
  w,
  x,
  y,
  z,
  i 
)    z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);

◆ R3

#define R3 (   v,
  w,
  x,
  y,
  z,
  i 
)    z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);

◆ R4

#define R4 (   v,
  w,
  x,
  y,
  z,
  i 
)    z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);

◆ rol

#define rol (   value,
  bits 
)    (((value) << (bits)) | ((value) >> (32 - (bits))))

◆ S11

#define S11   7

◆ S12

#define S12   12

◆ S13

#define S13   17

◆ S14

#define S14   22

◆ S21

#define S21   5

◆ S22

#define S22   9

◆ S23

#define S23   14

◆ S24

#define S24   20

◆ S31

#define S31   4

◆ S32

#define S32   11

◆ S33

#define S33   16

◆ S34

#define S34   23

◆ S41

#define S41   6

◆ S42

#define S42   10

◆ S43

#define S43   15

◆ S44

#define S44   21

◆ SHA1Final

#define SHA1Final (   digest,
  ctx 
)    Final(digest, ctx, 1)

◆ SHA1HANDSOFF

#define SHA1HANDSOFF

◆ SHA1Init

#define SHA1Init (   ctx)    Init(ctx, 1)

◆ SHA1Transform

#define SHA1Transform (   state,
  buffer 
)    Transform(state, buffer, 1)

◆ SHA1Update

#define SHA1Update (   ctx,
  data,
  len 
)    Update(ctx, (unsigned char *) data, len, 1)

Dokumentacja definicji typów

◆ EKG2_MD5_CTX

typedef struct EKG2_SHA1_CTX EKG2_MD5_CTX

Dokumentacja funkcji

◆ base16_encode()

static char* base16_encode ( const unsigned char *  data)
static

base16_encode()

Return base16 hash of data

Zwraca
static with 32 digit BASE16 HASH + NUL char.

◆ Encode()

static void Encode ( unsigned char *  output,
guint32 *  input,
unsigned int  len,
int  usesha 
)
static

◆ Final()

static void Final ( unsigned char  digest[20],
EKG2_SHA1_CTX context,
int  usesha 
)
static

◆ Init()

static void Init ( EKG2_SHA1_CTX context,
int  usesha 
)
static

◆ jabber_challenge_digest()

char* jabber_challenge_digest ( const char *  sid,
const char *  password,
const char *  nonce,
const char *  cnonce,
const char *  xmpp_temp,
const char *  realm 
)

jabber_challenge_digest()

Return base16 encoded hash for SASL MD5 CHALLENGE

Do zrobienia:
MD5Update() on NULL params will fail. XXX, no idea what to do.
Zwraca
static buffer with 32 digit BASE16 HASH + NUL char

◆ jabber_dcc_digest()

char* jabber_dcc_digest ( char *  sid,
char *  initiator,
char *  target 
)

[XXX] SOME TIME AGO, I had idea to connect jabber_dcc_digest() and jabber_digest() with one function, and use va_list for it... i don't know. jabber_dcc_digest()

Return SHA1 hash for SOCKS5 Bytestreams connections [DCC]
Make SHA1Update()'s on (uid, initiator and target)

Do zrobienia:
SHA1Update() on NULL params will fail. XXX, no idea what to do.
Do zrobienia:
We don't reencode params here to utf-8.
Zwraca
static buffer, with 40 digit SHA1 hash + NUL char

◆ jabber_digest()

char* jabber_digest ( const char *  sid,
const char *  password,
int  istlen 
)

jabber_digest()

Return SHA1 hash for jabber:iq:auth
Make SHA1Update()'s on recoded to utf-8 (sid and password)

Do zrobienia:
SHA1Update() on NULL params will fail. XXX, no idea what to do.
Zwraca
static buffer, with 40 digit SHA1 hash + NUL char

◆ jabber_sha1_generic()

char* jabber_sha1_generic ( char *  buf,
int  len 
)

◆ Transform()

static void Transform ( guint32  state[5],
unsigned char  buffer[64],
int  usesha 
)
static

◆ Update()

static void Update ( EKG2_SHA1_CTX context,
unsigned char *  data,
unsigned int  len,
int  usesha 
)
static

Dokumentacja zmiennych

◆ config_console_charset

char* config_console_charset