see http://mbed.org/users/okini3939/notebook/wattmeter-shield-on-mbed/

Dependencies:   mbed

Fork of GSwifi_xively by gs fan

Committer:
okini3939
Date:
Wed Nov 27 08:18:45 2013 +0000
Revision:
4:9a2415f2ab07
update GSwifiInterface library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 4:9a2415f2ab07 1 /*
okini3939 4:9a2415f2ab07 2 * source from http://www.ipa.go.jp/security/rfc/RFC3174JA.html
okini3939 4:9a2415f2ab07 3 */
okini3939 4:9a2415f2ab07 4 /*
okini3939 4:9a2415f2ab07 5 * sha1.h
okini3939 4:9a2415f2ab07 6 *
okini3939 4:9a2415f2ab07 7 * Description:
okini3939 4:9a2415f2ab07 8 * This is the header file for code which implements the Secure
okini3939 4:9a2415f2ab07 9 * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
okini3939 4:9a2415f2ab07 10 * April 17, 1995.
okini3939 4:9a2415f2ab07 11 *
okini3939 4:9a2415f2ab07 12 * Many of the variable names in this code, especially the
okini3939 4:9a2415f2ab07 13 * single character names, were used because those were the names
okini3939 4:9a2415f2ab07 14 * used in the publication.
okini3939 4:9a2415f2ab07 15 *
okini3939 4:9a2415f2ab07 16 * Please read the file sha1.c for more information.
okini3939 4:9a2415f2ab07 17 *
okini3939 4:9a2415f2ab07 18 */
okini3939 4:9a2415f2ab07 19
okini3939 4:9a2415f2ab07 20 #ifndef _SHA1_H_
okini3939 4:9a2415f2ab07 21 #define _SHA1_H_
okini3939 4:9a2415f2ab07 22
okini3939 4:9a2415f2ab07 23 #include "mbed.h"
okini3939 4:9a2415f2ab07 24 /*
okini3939 4:9a2415f2ab07 25 * If you do not have the ISO standard stdint.h header file, then you
okini3939 4:9a2415f2ab07 26 * must typdef the following:
okini3939 4:9a2415f2ab07 27 * name meaning
okini3939 4:9a2415f2ab07 28 * uint32_t unsigned 32 bit integer
okini3939 4:9a2415f2ab07 29 * uint8_t unsigned 8 bit integer (i.e., unsigned char)
okini3939 4:9a2415f2ab07 30 * int_least16_t integer of >= 16 bits
okini3939 4:9a2415f2ab07 31 *
okini3939 4:9a2415f2ab07 32 */
okini3939 4:9a2415f2ab07 33
okini3939 4:9a2415f2ab07 34 #ifndef _SHA_enum_
okini3939 4:9a2415f2ab07 35 #define _SHA_enum_
okini3939 4:9a2415f2ab07 36 enum
okini3939 4:9a2415f2ab07 37 {
okini3939 4:9a2415f2ab07 38 shaSuccess = 0,
okini3939 4:9a2415f2ab07 39 shaNull, /* Null pointer parameter */
okini3939 4:9a2415f2ab07 40 shaInputTooLong, /* input data too long */
okini3939 4:9a2415f2ab07 41 shaStateError /* called Input after Result */
okini3939 4:9a2415f2ab07 42 };
okini3939 4:9a2415f2ab07 43 #endif
okini3939 4:9a2415f2ab07 44 #define SHA1HashSize 20
okini3939 4:9a2415f2ab07 45
okini3939 4:9a2415f2ab07 46 /*
okini3939 4:9a2415f2ab07 47 * This structure will hold context information for the SHA-1
okini3939 4:9a2415f2ab07 48 * hashing operation
okini3939 4:9a2415f2ab07 49 */
okini3939 4:9a2415f2ab07 50 typedef struct SHA1Context
okini3939 4:9a2415f2ab07 51 {
okini3939 4:9a2415f2ab07 52 uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
okini3939 4:9a2415f2ab07 53
okini3939 4:9a2415f2ab07 54 uint32_t Length_Low; /* Message length in bits */
okini3939 4:9a2415f2ab07 55 uint32_t Length_High; /* Message length in bits */
okini3939 4:9a2415f2ab07 56
okini3939 4:9a2415f2ab07 57 /* Index into message block array */
okini3939 4:9a2415f2ab07 58 int_least16_t Message_Block_Index;
okini3939 4:9a2415f2ab07 59 uint8_t Message_Block[64]; /* 512-bit message blocks */
okini3939 4:9a2415f2ab07 60
okini3939 4:9a2415f2ab07 61 int Computed; /* Is the digest computed? */
okini3939 4:9a2415f2ab07 62 int Corrupted; /* Is the message digest corrupted? */
okini3939 4:9a2415f2ab07 63 } SHA1Context;
okini3939 4:9a2415f2ab07 64
okini3939 4:9a2415f2ab07 65 /*
okini3939 4:9a2415f2ab07 66 * Function Prototypes
okini3939 4:9a2415f2ab07 67 */
okini3939 4:9a2415f2ab07 68
okini3939 4:9a2415f2ab07 69 int SHA1Reset( SHA1Context *);
okini3939 4:9a2415f2ab07 70 int SHA1Input( SHA1Context *,
okini3939 4:9a2415f2ab07 71 const uint8_t *,
okini3939 4:9a2415f2ab07 72 unsigned int);
okini3939 4:9a2415f2ab07 73 int SHA1Result( SHA1Context *,
okini3939 4:9a2415f2ab07 74 uint8_t Message_Digest[SHA1HashSize]);
okini3939 4:9a2415f2ab07 75
okini3939 4:9a2415f2ab07 76
okini3939 4:9a2415f2ab07 77 void sha1 (const char *input, int len, char *output);
okini3939 4:9a2415f2ab07 78 #endif