ethereum/BREthereumHash.c
/**
 * Create a Hash by converting from a hex-encoded string of a hash.  The string must
 * begin with '0x'.
 */
Create a Hash by converting from a hex-encoded string of a hash.  The string must
begin with '0x'.
Create a Hash by converting from a hex - encoded string of a hash . The string must begin with ' 0x ' .
extern BREthereumHash
hashCreate (const char *string) {
    if (NULL == string || '\0' == string[0] || 0 == strcmp (string, "0x")) return hashCreateEmpty();
    assert (0 == strncmp (string, "0x", 2)
            && (2 + 2 * ETHEREUM_HASH_BYTES) == strlen (string));
    BREthereumHash hash;
    decodeHex(hash.bytes, ETHEREUM_HASH_BYTES, &string[2], 2 * ETHEREUM_HASH_BYTES);
    return hash;
}
extern BREthereumHash hashCreate ( const char * string ) { if ( NULL == string || ' \0 ' == string [ 0 ] || 0 == strcmp ( string , " " ) ) return hashCreateEmpty ( ) ; assert ( 0 == strncmp ( string , " " , 2 ) && ( 2 + 2 * ETHEREUM_HASH_BYTES ) == strlen ( string ) ) ; BREthereumHash hash ; decodeHex ( hash . bytes , ETHEREUM_HASH_BYTES , & string [ 2 ] , 2 * ETHEREUM_HASH_BYTES ) ; return hash ; }
Create a Hash by converting from a hex-encoded string of a hash.
Create a Hash by converting from a hex - encoded string of a hash .