Class DSHA1

Inherits from:
Object
Declared in:
DSHA1.h

Class Hierarchy

    Object
      |
      +---DSHA1

Class Description

The DSHA1 class implements a number of methods for using the NIST's SHA algorithm. The code is based on 'SHA-1 in C' by Steve Reid (steve[at]edmweb.com) which is in Public Domain.

Example:
#include <stdio.h>
#include "ofc/DSHA1.h"

int main(int argc, char *argv[])
{
  DSHA1 *sha1  = [DSHA1 alloc];
  DSHA1 *sha2  = [DSHA1 new  ];
  DText *str;
  int    i;

  [sha1 init :"Test string for the SHA1 class"]; // Init with c-string

  str = [sha1 hexdigest];              // Convert to string and print
  printf("SHA1 for the test string:%s.\n", [str cstring]);
  [str free];

  for (i = 0; i < 10; i++)
  {
    [sha2 update :"abcdefghijklmnopqrstuvwxyz"]; // Repeated adding strings to sha
  }
  str = [sha2 hexdigest];              // Convert to string and print
  printf("SHA1 for the repeated test string:%s.\n", [str cstring]);
  [str free];

  [sha1 free];                         // Cleanup
  [sha2 free];

  return 0;
}
Last modified:
28-Jul-2008 (DSHA1.h)

Instance Variables

private uint32_t _state[5]
private uint32_t _count[2]
private unsigned char _buffer[64]

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0