pike.git / src / post_modules / Nettle / hash.cmod

version» Context lines:

pike.git/src/post_modules/Nettle/hash.cmod:105:    PIKEFUN int(0..) block_size()    optflags OPT_TRY_OPTIMIZE;    {    if (!THIS->meta)    Pike_error("Hash not properly initialized.\n");       push_int(THIS->meta->block_size);    }       -  /*! @decl string(0..255) hash(string data) +  /*! @decl string(0..255) hash(string(0..255) data)    *!    *! Works as a (faster) shortcut for    *! @expr{State()->update(data)->digest()@}, where State is    *! the hash state class corresponding to this Hash.    *!    *! @seealso    *! @[State()->update()] and @[State()->digest()].    */ -  PIKEFUN string(0..255) hash(string in) +  PIKEFUN string(0..255) hash(string(0..255) in)    optflags OPT_TRY_OPTIMIZE;    {    void *ctx;    struct pike_string *out;    unsigned digest_length;    const struct nettle_hash *meta = THIS->meta;       if (!meta)    Pike_error("Hash not properly initialized.\n");    NO_WIDE_STRING(in);
pike.git/src/post_modules/Nettle/hash.cmod:238:       THREADS_DISALLOW();    out = begin_shared_string(meta->digest_size);    meta->digest(ctx, meta->digest_size, (uint8_t *)out->str);       pop_n_elems(args);    push_string(end_shared_string(out));    }       /* NOTE: This is NOT the MIME base64 table! */ -  static const char b64tab[64] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +  static const char b64tab[64] = +  "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";       static inline void b64enc(char *dest, int a, int b, int c, int sz)    {    unsigned int bitbuf = a | (b << 8) | (c << 16);    while (sz--) {    *(dest++) = b64tab[bitbuf & 63];    bitbuf >>= 6;    }    }    -  /*! @decl string(0..127) crypt_hash(string password, string salt, int rounds) +  /*! @decl string(0..127) crypt_hash(string(0..255) password, @ +  *! string(0..255) salt, int rounds)    *!    *! Password hashing function in @[crypt_md5()]-style.    *!    *! Implements the algorithm described in    *! @url{http://www.akkadia.org/drepper/SHA-crypt.txt@}.    *!    *! This is the algorithm used by @tt{crypt(2)@} in    *! methods @tt{$5$@} (SHA256) and @tt{$6$@} (SHA512).    *!    *! The @[password] memory will be cleared before released.    *!    *! @seealso    *! @[crypt_md5()]    */ -  PIKEFUN string(0..127) crypt_hash(string password, string salt, int rounds) +  PIKEFUN string(0..127) crypt_hash(string(0..255) password, +  string(0..255) salt, int rounds)    {    struct pike_string *res;    const struct nettle_hash *meta = THIS->meta;    void *ctx;    uint8_t *abcbuf;    uint8_t *dpbuf;    uint8_t *dsbuf;       unsigned char *p;    unsigned char *s;