您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Ch函数代码示例

51自学网 2021-06-01 20:09:52
  C++
这篇教程C++ Ch函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中Ch函数的典型用法代码示例。如果您正苦于以下问题:C++ Ch函数的具体用法?C++ Ch怎么用?C++ Ch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了Ch函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sha256_transform

// Transform one block and update state.// State is in native byte order, data is big endian.void sha256_transform(uint32_t state[8], const uint32_t data[16]){    uint32_t T[20];    uint32_t W[32];    unsigned int i = 0, j = 0;    uint32_t *t = T+8;    memcpy(t, state, 32);    uint32_t e = t[4], a = t[0];    do     {        uint32_t w = be32_to_cpu(data[j]);        W[j] = w;        w += SHA256_K_GET(j);        w += t[7];        w += S1(e);        w += Ch(e, t[5], t[6]);        e = t[3] + w;        t[3] = t[3+8] = e;        w += S0(t[0]);        a = w + Maj(a, t[1], t[2]);        t[-1] = t[7] = a;        --t;        ++j;        if (j%8 == 0)            t += 8;    } while (j<16);    do    {        i = j & 0xf;        uint32_t w = s1(W[i+16-2]) + s0(W[i+16-15]) + W[i] + W[i+16-7];        W[i+16] = W[i] = w;        w += SHA256_K_GET(j);        w += t[7];        w += S1(e);        w += Ch(e, t[5], t[6]);        e = t[3] + w;        t[3] = t[3+8] = e;        w += S0(t[0]);        a = w + Maj(a, t[1], t[2]);        t[-1] = t[7] = a;        w = s1(W[(i+1)+16-2]) + s0(W[(i+1)+16-15]) + W[(i+1)] + W[(i+1)+16-7];        W[(i+1)+16] = W[(i+1)] = w;        w += SHA256_K_GET(j+1);        w += (t-1)[7];        w += S1(e);        w += Ch(e, (t-1)[5], (t-1)[6]);        e = (t-1)[3] + w;        (t-1)[3] = (t-1)[3+8] = e;        w += S0((t-1)[0]);        a = w + Maj(a, (t-1)[1], (t-1)[2]);        (t-1)[-1] = (t-1)[7] = a;        t -= 2;        j += 2;        if (j % 8 == 0)            t += 8;    } while (j<64);    state[0] += a;    state[1] += t[1];    state[2] += t[2];    state[3] += t[3];    state[4] += e;    state[5] += t[5];    state[6] += t[6];    state[7] += t[7];}
开发者ID:biddyweb,项目名称:entropy,代码行数:73,


示例2: print_cdata_node

 inline OutIt print_cdata_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) {     assert(node->type() == node_cdata);     if (!(flags & print_no_indenting))         out = fill_chars(out, indent, Ch('/t'));     *out = Ch('<'); ++out;     *out = Ch('!'); ++out;     *out = Ch('['); ++out;     *out = Ch('C'); ++out;     *out = Ch('D'); ++out;     *out = Ch('A'); ++out;     *out = Ch('T'); ++out;     *out = Ch('A'); ++out;     *out = Ch('['); ++out;     out = copy_chars(node->value(), node->value() + node->value_size(), out);     *out = Ch(']'); ++out;     *out = Ch(']'); ++out;     *out = Ch('>'); ++out;     return out; }
开发者ID:281627166,项目名称:NoahGameFrame,代码行数:20,


示例3: copy_and_expand_chars

 inline OutIt copy_and_expand_chars(const Ch *begin, const Ch *end, Ch noexpand, OutIt out) {     while (begin != end)     {         if (*begin == noexpand)         {             *out++ = *begin;    // No expansion, copy character         }         else         {             switch (*begin)             {             case Ch('<'):                 *out++ = Ch('&'); *out++ = Ch('l'); *out++ = Ch('t'); *out++ = Ch(';');                 break;             case Ch('>'):                 *out++ = Ch('&'); *out++ = Ch('g'); *out++ = Ch('t'); *out++ = Ch(';');                 break;             case Ch('/''):                 *out++ = Ch('&'); *out++ = Ch('a'); *out++ = Ch('p'); *out++ = Ch('o'); *out++ = Ch('s'); *out++ = Ch(';');                 break;             case Ch('"'):                 *out++ = Ch('&'); *out++ = Ch('q'); *out++ = Ch('u'); *out++ = Ch('o'); *out++ = Ch('t'); *out++ = Ch(';');                 break;             case Ch('&'):                 *out++ = Ch('&'); *out++ = Ch('a'); *out++ = Ch('m'); *out++ = Ch('p'); *out++ = Ch(';');                 break;             default:                 *out++ = *begin;    // No expansion, copy character             }         }         ++begin;    // Step to next character     }     return out; }
开发者ID:281627166,项目名称:NoahGameFrame,代码行数:35,


示例4: sha256_block_data_order

static void sha256_block_data_order(SHA256_CTX *ctx, const void *in,                                    size_t num){    unsigned MD32_REG_T a, b, c, d, e, f, g, h, s0, s1, T1, T2;    SHA_LONG X[16], l;    int i;    const unsigned char *data = in;    while (num--) {        a = ctx->h[0];        b = ctx->h[1];        c = ctx->h[2];        d = ctx->h[3];        e = ctx->h[4];        f = ctx->h[5];        g = ctx->h[6];        h = ctx->h[7];        for (i = 0; i < 16; i++) {            HOST_c2l(data, l);            T1 = X[i] = l;            T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i];            T2 = Sigma0(a) + Maj(a, b, c);            h = g;            g = f;            f = e;            e = d + T1;            d = c;            c = b;            b = a;            a = T1 + T2;        }        for (; i < 64; i++) {            s0 = X[(i + 1) & 0x0f];            s0 = sigma0(s0);            s1 = X[(i + 14) & 0x0f];            s1 = sigma1(s1);            T1 = X[i & 0xf] += s0 + s1 + X[(i + 9) & 0xf];            T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i];            T2 = Sigma0(a) + Maj(a, b, c);            h = g;            g = f;            f = e;            e = d + T1;            d = c;            c = b;            b = a;            a = T1 + T2;        }        ctx->h[0] += a;        ctx->h[1] += b;        ctx->h[2] += c;        ctx->h[3] += d;        ctx->h[4] += e;        ctx->h[5] += f;        ctx->h[6] += g;        ctx->h[7] += h;    }}
开发者ID:bbidd985,项目名称:IEEE_Taggant_System,代码行数:64,


示例5: ccsha512_ltc_compress

/* compress 1024-bits */void ccsha512_ltc_compress(ccdigest_state_t state, unsigned long nblocks, const void *in){    uint64_t S[8], W[80], t0, t1;    int i;    uint64_t *s = ccdigest_u64(state);    const unsigned char *buf = in;    while(nblocks--) {        /* copy state into S */        for (i = 0; i < 8; i++) {            S[i] = s[i];        }        /* copy the state into 1024-bits into W[0..15] */        for (i = 0; i < 16; i++) {            CC_LOAD64_BE(W[i], buf + (8*i));        }        /* fill W[16..79] */        for (i = 16; i < 80; i++) {            W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16];        }        /* Compress */    #ifdef CC_SMALL_CODE        for (i = 0; i < 80; i++) {            t0 = S[7] + Sigma1(S[4]) + Ch(S[4], S[5], S[6]) + K[i] + W[i];            t1 = Sigma0(S[0]) + Maj(S[0], S[1], S[2]);            S[7] = S[6];            S[6] = S[5];            S[5] = S[4];            S[4] = S[3] + t0;            S[3] = S[2];            S[2] = S[1];            S[1] = S[0];            S[0] = t0 + t1;        }    #else    #define RND(a,b,c,d,e,f,g,h,i)                    /         t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i];   /         t1 = Sigma0(a) + Maj(a, b, c);                  /         d += t0;                                        /         h  = t0 + t1;         for (i = 0; i < 80; i += 8) {             RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i+0);             RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],i+1);             RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],i+2);             RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],i+3);             RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],i+4);             RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],i+5);             RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],i+6);             RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],i+7);         }    #endif        /* feedback */        for (i = 0; i < 8; i++) {            s[i] = s[i] + S[i];        }        buf+=CCSHA512_BLOCK_SIZE;    }}
开发者ID:randombit,项目名称:hacrypto,代码行数:66,


示例6: operator

 void operator()(unsigned long u) const {     u = (std::min)(u, static_cast<unsigned long>((std::numeric_limits<Ch>::max)()));     c.string += Ch(u); }
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:5,


示例7: xml_writer_make_settings

 xml_writer_settings<Ch> xml_writer_make_settings(Ch indent_char = Ch(' '),     typename std::basic_string<Ch>::size_type indent_count = 0,     const std::basic_string<Ch> &encoding = widen<Ch>("utf-8")) {     return xml_writer_settings<Ch>(indent_char, indent_count, encoding); }
开发者ID:00liujj,项目名称:dealii,代码行数:6,


示例8: sha256_transform

static void sha256_transform(uint32_t *state, const uint8_t buffer[64]){    unsigned int i, a, b, c, d, e, f, g, h;    uint32_t block[64];    uint32_t T1;    a = state[0];    b = state[1];    c = state[2];    d = state[3];    e = state[4];    f = state[5];    g = state[6];    h = state[7];#if CONFIG_SMALL    for (i = 0; i < 64; i++) {        uint32_t T2;        if (i < 16)            T1 = blk0(i);        else            T1 = blk(i);        T1 += h + Sigma1_256(e) + Ch(e, f, g) + K256[i];        T2 = Sigma0_256(a) + Maj(a, b, c);        h = g;        g = f;        f = e;        e = d + T1;        d = c;        c = b;        b = a;        a = T1 + T2;    }#else    i = 0;#define R256_0 /    ROUND256_0_TO_15(a, b, c, d, e, f, g, h); /    ROUND256_0_TO_15(h, a, b, c, d, e, f, g); /    ROUND256_0_TO_15(g, h, a, b, c, d, e, f); /    ROUND256_0_TO_15(f, g, h, a, b, c, d, e); /    ROUND256_0_TO_15(e, f, g, h, a, b, c, d); /    ROUND256_0_TO_15(d, e, f, g, h, a, b, c); /    ROUND256_0_TO_15(c, d, e, f, g, h, a, b); /    ROUND256_0_TO_15(b, c, d, e, f, g, h, a)    R256_0; R256_0;#define R256_16 /    ROUND256_16_TO_63(a, b, c, d, e, f, g, h); /    ROUND256_16_TO_63(h, a, b, c, d, e, f, g); /    ROUND256_16_TO_63(g, h, a, b, c, d, e, f); /    ROUND256_16_TO_63(f, g, h, a, b, c, d, e); /    ROUND256_16_TO_63(e, f, g, h, a, b, c, d); /    ROUND256_16_TO_63(d, e, f, g, h, a, b, c); /    ROUND256_16_TO_63(c, d, e, f, g, h, a, b); /    ROUND256_16_TO_63(b, c, d, e, f, g, h, a)    R256_16; R256_16; R256_16;    R256_16; R256_16; R256_16;#endif    state[0] += a;    state[1] += b;    state[2] += c;    state[3] += d;    state[4] += e;    state[5] += f;    state[6] += g;    state[7] += h;}
开发者ID:18565773346,项目名称:android-h264-decoder,代码行数:69,


示例9: block

/*========================================================================Routine Description:    SHA1 computation for one block (512 bits)Arguments:    pSHA_CTX        Pointer to SHA1_CTX_STRUCReturn Value:    NoneNote:    None========================================================================*/VOID RT_SHA1_Hash (    IN  SHA1_CTX_STRUC *pSHA_CTX){    uint32_t W_i,t;    uint32_t W[80];    uint32_t a,b,c,d,e,T,f_t = 0;    /* Prepare the message schedule, {W_i}, 0 < t < 15 */    memmove(W, pSHA_CTX->Block, SHA1_BLOCK_SIZE);    for (W_i = 0; W_i < 16; W_i++) {        W[W_i] = cpu2be32(W[W_i]); /* Endian Swap */    } /* End of for */    for (W_i = 16; W_i < 80; W_i++) {        W[W_i] = ROTL32((W[W_i - 3] ^ W[W_i - 8] ^ W[W_i - 14] ^ W[W_i - 16]),1);    } /* End of for */    /* SHA256 hash computation */    /* Initialize the working variables */    a = pSHA_CTX->HashValue[0];    b = pSHA_CTX->HashValue[1];    c = pSHA_CTX->HashValue[2];    d = pSHA_CTX->HashValue[3];    e = pSHA_CTX->HashValue[4];    /* 80 rounds */    for (t = 0;t < 20;t++) {        f_t = Ch(b,c,d);        T = ROTL32(a,5) + f_t + e + SHA1_K[0] + W[t];        e = d;        d = c;        c = ROTL32(b,30);        b = a;        a = T;     } /* End of for */    for (t = 20;t < 40;t++) {        f_t = Parity(b,c,d);        T = ROTL32(a,5) + f_t + e + SHA1_K[1] + W[t];        e = d;        d = c;        c = ROTL32(b,30);        b = a;        a = T;     } /* End of for */    for (t = 40;t < 60;t++) {        f_t = Maj(b,c,d);        T = ROTL32(a,5) + f_t + e + SHA1_K[2] + W[t];        e = d;        d = c;        c = ROTL32(b,30);        b = a;        a = T;     } /* End of for */    for (t = 60;t < 80;t++) {        f_t = Parity(b,c,d);        T = ROTL32(a,5) + f_t + e + SHA1_K[3] + W[t];        e = d;        d = c;        c = ROTL32(b,30);        b = a;        a = T;     } /* End of for */     /* Compute the i^th intermediate hash value H^(i) */     pSHA_CTX->HashValue[0] += a;     pSHA_CTX->HashValue[1] += b;     pSHA_CTX->HashValue[2] += c;     pSHA_CTX->HashValue[3] += d;     pSHA_CTX->HashValue[4] += e;    memset(pSHA_CTX->Block, 0, SHA1_BLOCK_SIZE);    pSHA_CTX->BlockLen = 0;} /* End of RT_SHA1_Hash */
开发者ID:ulli-kroll,项目名称:mt7612u,代码行数:90,


示例10: info_writer_settings

 info_writer_settings(Ch indent_char = Ch(' '), unsigned indent_count = 4):     indent_char(indent_char),     indent_count(indent_count) { }
开发者ID:alistairwalsh,项目名称:LSL-gazzlab-branch,代码行数:5,


示例11: info_writer_make_settings

 info_writer_settings<Ch> info_writer_make_settings(Ch indent_char = Ch(' '), unsigned indent_count = 4) {     return info_writer_settings<Ch>(indent_char, indent_count); }
开发者ID:alistairwalsh,项目名称:LSL-gazzlab-branch,代码行数:4,


示例12: main

int main(int argc, char* argv[]) {    if(argc < 2) {        printf("Usage: sha256 <string>/n");        return 0;    }    // 4.2.2    uint32_t K[] = {        0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,        0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,        0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,        0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,        0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,        0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,        0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,        0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2    };    // 5.3.2    uint32_t H[] = {        0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19    };    char* msg = argv[1];    size_t len = strlen(msg);    // 5.1.1    uint64_t l = len * sizeof(char) * 8;    size_t k = (448 - l - 1) % 512;    if(k < 0) k += 512;    assert((l+1+k) % 512 == 448);    size_t msgSize = l + 1 + k + 64;    char* msgPad = (char*)calloc((msgSize / 8), sizeof(char));    memcpy(msgPad, msg, len);    msgPad[len] = 0x80;    l = swapE64(l);    memcpy(msgPad+(msgSize/8)-8, &l, 8);    // 5.2.1    size_t N = msgSize / 512;    // 6.2    uint32_t v[8];    uint32_t W[64];    uint32_t* M = (uint32_t*)msgPad;    uint32_t T1, T2;    for(size_t i = 0; i < N * 16; i++) {        M[i] = swapE32(M[i]);    }    // 6.2.2    for(size_t i = 0; i < N; i++) {        // 1        for(size_t t = 0; t < 16; t++) {            W[t] = M[i*16 + t];        }        for(size_t t = 16; t < 64; t++) {            W[t] = sig1(W[t-2]) + W[t-7] + sig0(W[t-15]) + W[t-16];        }        // 2        for(size_t t = 0; t < 8; t++) {            v[t] = H[t];        }        // 3        for(size_t t = 0; t < 64; t++) {            // a=0 b=1 c=2 d=3 e=4 f=5 g=6 h=7            T1 = v[7] + ep1(v[4]) + Ch(v[4], v[5], v[6]) + K[t] + W[t];            T2 = ep0(v[0]) + Maj(v[0], v[1], v[2]);            v[7] = v[6];            v[6] = v[5];            v[5] = v[4];            v[4] = v[3] + T1;            v[3] = v[2];            v[2] = v[1];            v[1] = v[0];            v[0] = T1 + T2;        }        for(size_t t = 0; t < 8; t++) {            H[t] += v[t];        }    }    for(size_t i = 0; i < 8; i++) {        H[i] = swapE32(H[i]);        hex(&H[i], 4);    }    printf("/n");    free(msgPad);    return 0;}
开发者ID:noryb009,项目名称:sha256,代码行数:98,


示例13: GetTopCtrl

void AssistEditor::SyncParamInfo(){	String qtf;	Ctrl *p = GetTopCtrl();	int mpar = INT_MAX;	int pos = 0;	if(p && p->HasFocusDeep()) {		for(int q = 0; q < PARAMN; q++) {			ParamInfo& m = param[q];			int i = GetCursorLine();			if(m.line >= 0 && m.line < GetLineCount() && i >= m.line && i < m.line + 10			   && m.editfile == theide->editfile && GetWLine(m.line).StartsWith(m.test)) {				int c = GetCursor();				i = GetPos(m.line) + m.test.GetCount();				if(c >= i) {					int par = 0;					int pari = 0;					for(;;) {						int ch = Ch(i++);						if(i > c) {							if(par < mpar) {								qtf = "[A1  " + DecoratedItem(m.item.name, m.item, m.item.natural, pari);								mpar = par;								pos = m.pos;							}							break;						}						if(ch == ')') {							if(par <= 0)								break;							par--;						}						if(ch == '(')							par++;						if(ch == ',' && par == 0)							pari++;					}				}			}		}	}	if(param_qtf != qtf)		param_info.SetQTF(qtf);	Rect r = GetLineScreenRect(GetCursorLine());	int cx = max(GetSize().cx - 30, 300);	int h = param_info.GetHeight(cx);	h = min(h, 550);	int y = r.top - h - 6;	if(y < GetWorkArea().top)		y = r.bottom;	r = RectC(r.left, y, min(param_info.GetWidth(), cx) + 8, h + 6);	r.OffsetHorz(GetColumnLine(pos).x * GetFontSize().cx);	r.OffsetHorz(min(GetWorkArea().right - r.right, 0));	if(param_qtf != qtf || r != param_info.GetRect()) {		param_qtf = qtf;		if(IsNull(qtf)) {			if(param_info.IsOpen())				param_info.Close();		}		else {			param_info.SetRect(r);			if(!param_info.IsOpen() && !IsSelection())				param_info.Ctrl::PopUp(this, false, false, false);		}	}}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:66,


示例14: transform

//.........这里部分代码省略.........    for (i = 0, p2 = (byte *) w; i < 16; i++, p2 += 8)      {	p2[7] = *data++;	p2[6] = *data++;	p2[5] = *data++;	p2[4] = *data++;	p2[3] = *data++;	p2[2] = *data++;	p2[1] = *data++;	p2[0] = *data++;      }  }#endif#define S0(x) (ROTR((x),1) ^ ROTR((x),8) ^ ((x)>>7))#define S1(x) (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6))  for (t = 16; t < 80; t++)    w[t] = S1 (w[t - 2]) + w[t - 7] + S0 (w[t - 15]) + w[t - 16];  for (t = 0; t < 80; )    {      u64 t1, t2;      /* Performance on a AMD Athlon(tm) Dual Core Processor 4050e         with gcc 4.3.3 using gcry_md_hash_buffer of each 10000 bytes         initialized to 0,1,2,3...255,0,... and 1000 iterations:         Not unrolled with macros:  440ms         Unrolled with macros:      350ms         Unrolled with inline:      330ms      */#if 0 /* Not unrolled.  */      t1 = h + Sum1 (e) + Ch (e, f, g) + k[t] + w[t];      t2 = Sum0 (a) + Maj (a, b, c);      h = g;      g = f;      f = e;      e = d + t1;      d = c;      c = b;      b = a;      a = t1 + t2;      t++;#else /* Unrolled to interweave the chain variables.  */      t1 = h + Sum1 (e) + Ch (e, f, g) + k[t] + w[t];      t2 = Sum0 (a) + Maj (a, b, c);      d += t1;      h  = t1 + t2;      t1 = g + Sum1 (d) + Ch (d, e, f) + k[t+1] + w[t+1];      t2 = Sum0 (h) + Maj (h, a, b);      c += t1;      g  = t1 + t2;      t1 = f + Sum1 (c) + Ch (c, d, e) + k[t+2] + w[t+2];      t2 = Sum0 (g) + Maj (g, h, a);      b += t1;      f  = t1 + t2;      t1 = e + Sum1 (b) + Ch (b, c, d) + k[t+3] + w[t+3];      t2 = Sum0 (f) + Maj (f, g, h);      a += t1;      e  = t1 + t2;      t1 = d + Sum1 (a) + Ch (a, b, c) + k[t+4] + w[t+4];      t2 = Sum0 (e) + Maj (e, f, g);      h += t1;      d  = t1 + t2;      t1 = c + Sum1 (h) + Ch (h, a, b) + k[t+5] + w[t+5];      t2 = Sum0 (d) + Maj (d, e, f);      g += t1;      c  = t1 + t2;      t1 = b + Sum1 (g) + Ch (g, h, a) + k[t+6] + w[t+6];      t2 = Sum0 (c) + Maj (c, d, e);      f += t1;      b  = t1 + t2;      t1 = a + Sum1 (f) + Ch (f, g, h) + k[t+7] + w[t+7];      t2 = Sum0 (b) + Maj (b, c, d);      e += t1;      a  = t1 + t2;            t += 8;#endif    }  /* Update chaining vars.  */  hd->h0 += a;  hd->h1 += b;  hd->h2 += c;  hd->h3 += d;  hd->h4 += e;  hd->h5 += f;  hd->h6 += g;  hd->h7 += h;}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:101,


示例15: sha512_compress

static int  sha512_compress(hash_state * md, const unsigned char *buf)#endif{    ulong64 S[8], W[80], t0, t1;    int i;    /* copy state into S */    for (i = 0; i < 8; i++) {        S[i] = md->sha512.state[i];    }    /* copy the state into 1024-bits into W[0..15] */    for (i = 0; i < 16; i++) {        LOAD64H(W[i], buf + (8*i));    }    /* fill W[16..79] */    for (i = 16; i < 80; i++) {        W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16];    }    /* Compress */#ifdef LTC_SMALL_CODE    for (i = 0; i < 80; i++) {        t0 = S[7] + Sigma1(S[4]) + Ch(S[4], S[5], S[6]) + K[i] + W[i];        t1 = Sigma0(S[0]) + Maj(S[0], S[1], S[2]);        S[7] = S[6];        S[6] = S[5];        S[5] = S[4];        S[4] = S[3] + t0;        S[3] = S[2];        S[2] = S[1];        S[1] = S[0];        S[0] = t0 + t1;    }#else#define RND(a,b,c,d,e,f,g,h,i)                    /     t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i];   /     t1 = Sigma0(a) + Maj(a, b, c);                  /     d += t0;                                        /     h  = t0 + t1;    for (i = 0; i < 80; i += 8) {        RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i+0);        RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],i+1);        RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],i+2);        RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],i+3);        RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],i+4);        RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],i+5);        RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],i+6);        RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],i+7);    }#endif    /* feedback */    for (i = 0; i < 8; i++) {        md->sha512.state[i] = md->sha512.state[i] + S[i];    }    return CRYPT_OK;}
开发者ID:DCIT,项目名称:perl-CryptX,代码行数:62,


示例16: print_element_node

        inline OutIt print_element_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)        {            assert(node->type() == node_element);            // Print element name and attributes, if any            if (!(flags & print_no_indenting)) {                //out = fill_chars(out, indent, Ch('/t'));                out = fill_chars(out, indent, Ch(' '));                out = fill_chars(out, indent, Ch(' '));            }            *out = Ch('<'), ++out;            out = copy_chars(node->name(), node->name() + node->name_size(), out);            out = print_attributes(out, node);                        // If node is childless            if (node->value_size() == 0 && !node->first_node())            {                // Print childless node tag ending                *out = Ch('/'), ++out;                *out = Ch('>'), ++out;            }            else            {                // Print normal node tag ending                *out = Ch('>'), ++out;                // Test if node contains a single data node only (and no other nodes)                xml_node<Ch> *child = node->first_node();                if (!child)                {                    // If node has no children, only print its value without indenting                    out = copy_and_expand_chars(node->value(), node->value() + node->value_size(), Ch(0), out);                }                else if (child->next_sibling() == 0 && child->type() == node_data)                {                    // If node has a sole data child, only print its value without indenting                    out = copy_and_expand_chars(child->value(), child->value() + child->value_size(), Ch(0), out);                }                else                {                    // Print all children with full indenting                    if (!(flags & print_no_indenting))                        *out = Ch('/n'), ++out;                    out = print_children(out, node, flags, indent + 1);                    if (!(flags & print_no_indenting)) {                        //out = fill_chars(out, indent, Ch('/t'));                        out = fill_chars(out, indent, Ch(' '));                        out = fill_chars(out, indent, Ch(' '));                    }                }                // Print node end                *out = Ch('<'), ++out;                *out = Ch('/'), ++out;                out = copy_chars(node->name(), node->name() + node->name_size(), out);                *out = Ch('>'), ++out;            }            return out;        }
开发者ID:OxfordSKA,项目名称:OSKAR,代码行数:59,


示例17: create_escapes

 std::basic_string<Ch> create_escapes(const std::basic_string<Ch> &s) {     std::basic_string<Ch> result;     typename std::basic_string<Ch>::const_iterator b = s.begin();     typename std::basic_string<Ch>::const_iterator e = s.end();     while (b != e)     {         // This assumes an ASCII superset. But so does everything in PTree.         // We escape everything outside ASCII, because this code can't         // handle high unicode characters.         if (*b == 0x20 || *b == 0x21 || (*b >= 0x23 && *b <= 0x2E) ||             (*b >= 0x30 && *b <= 0x5B) || (*b >= 0x5D && *b <= 0xFF))             result += *b;         else if (*b == Ch('/b')) result += Ch('//'), result += Ch('b');         else if (*b == Ch('/f')) result += Ch('//'), result += Ch('f');         else if (*b == Ch('/n')) result += Ch('//'), result += Ch('n');         else if (*b == Ch('/r')) result += Ch('//'), result += Ch('r');         else if (*b == Ch('/')) result += Ch('//'), result += Ch('/');         else if (*b == Ch('"'))  result += Ch('//'), result += Ch('"');         else if (*b == Ch('//')) result += Ch('//'), result += Ch('//');         else         {             const char *hexdigits = "0123456789ABCDEF";             typedef typename make_unsigned<Ch>::type UCh;             unsigned long u = (std::min)(static_cast<unsigned long>(                                              static_cast<UCh>(*b)),                                          0xFFFFul);             int d1 = u / 4096; u -= d1 * 4096;             int d2 = u / 256; u -= d2 * 256;             int d3 = u / 16; u -= d3 * 16;             int d4 = u;             result += Ch('//'); result += Ch('u');             result += Ch(hexdigits[d1]); result += Ch(hexdigits[d2]);             result += Ch(hexdigits[d3]); result += Ch(hexdigits[d4]);         }         ++b;     }     return result; }
开发者ID:ALuehmann,项目名称:labstreaminglayer,代码行数:39,


示例18: sha256d_ms

//.........这里部分代码省略.........	W[20] = S[20];	W[22] = S[22];	W[23] = S[23];	W[24] = S[24];	W[30] = S[30];	W[31] = S[31];	memcpy(S + 8, sha256d_hash1 + 8, 32);	S[16] = s1(sha256d_hash1[14]) + sha256d_hash1[ 9] + s0(S[ 1]) + S[ 0];	S[17] = s1(sha256d_hash1[15]) + sha256d_hash1[10] + s0(S[ 2]) + S[ 1];	S[18] = s1(S[16]) + sha256d_hash1[11] + s0(S[ 3]) + S[ 2];	S[19] = s1(S[17]) + sha256d_hash1[12] + s0(S[ 4]) + S[ 3];	S[20] = s1(S[18]) + sha256d_hash1[13] + s0(S[ 5]) + S[ 4];	S[21] = s1(S[19]) + sha256d_hash1[14] + s0(S[ 6]) + S[ 5];	S[22] = s1(S[20]) + sha256d_hash1[15] + s0(S[ 7]) + S[ 6];	S[23] = s1(S[21]) + S[16] + s0(sha256d_hash1[ 8]) + S[ 7];	S[24] = s1(S[22]) + S[17] + s0(sha256d_hash1[ 9]) + sha256d_hash1[ 8];	S[25] = s1(S[23]) + S[18] + s0(sha256d_hash1[10]) + sha256d_hash1[ 9];	S[26] = s1(S[24]) + S[19] + s0(sha256d_hash1[11]) + sha256d_hash1[10];	S[27] = s1(S[25]) + S[20] + s0(sha256d_hash1[12]) + sha256d_hash1[11];	S[28] = s1(S[26]) + S[21] + s0(sha256d_hash1[13]) + sha256d_hash1[12];	S[29] = s1(S[27]) + S[22] + s0(sha256d_hash1[14]) + sha256d_hash1[13];	S[30] = s1(S[28]) + S[23] + s0(sha256d_hash1[15]) + sha256d_hash1[14];	S[31] = s1(S[29]) + S[24] + s0(S[16])             + sha256d_hash1[15];	for (i = 32; i < 60; i += 2) {		S[i]   = s1(S[i - 2]) + S[i - 7] + s0(S[i - 15]) + S[i - 16];		S[i+1] = s1(S[i - 1]) + S[i - 6] + s0(S[i - 14]) + S[i - 15];	}	S[60] = s1(S[58]) + S[53] + s0(S[45]) + S[44];	sha256_init(hash);	RNDr(hash, S,  0);	RNDr(hash, S,  1);	RNDr(hash, S,  2);	RNDr(hash, S,  3);	RNDr(hash, S,  4);	RNDr(hash, S,  5);	RNDr(hash, S,  6);	RNDr(hash, S,  7);	RNDr(hash, S,  8);	RNDr(hash, S,  9);	RNDr(hash, S, 10);	RNDr(hash, S, 11);	RNDr(hash, S, 12);	RNDr(hash, S, 13);	RNDr(hash, S, 14);	RNDr(hash, S, 15);	RNDr(hash, S, 16);	RNDr(hash, S, 17);	RNDr(hash, S, 18);	RNDr(hash, S, 19);	RNDr(hash, S, 20);	RNDr(hash, S, 21);	RNDr(hash, S, 22);	RNDr(hash, S, 23);	RNDr(hash, S, 24);	RNDr(hash, S, 25);	RNDr(hash, S, 26);	RNDr(hash, S, 27);	RNDr(hash, S, 28);	RNDr(hash, S, 29);	RNDr(hash, S, 30);	RNDr(hash, S, 31);	RNDr(hash, S, 32);	RNDr(hash, S, 33);	RNDr(hash, S, 34);	RNDr(hash, S, 35);	RNDr(hash, S, 36);	RNDr(hash, S, 37);	RNDr(hash, S, 38);	RNDr(hash, S, 39);	RNDr(hash, S, 40);	RNDr(hash, S, 41);	RNDr(hash, S, 42);	RNDr(hash, S, 43);	RNDr(hash, S, 44);	RNDr(hash, S, 45);	RNDr(hash, S, 46);	RNDr(hash, S, 47);	RNDr(hash, S, 48);	RNDr(hash, S, 49);	RNDr(hash, S, 50);	RNDr(hash, S, 51);	RNDr(hash, S, 52);	RNDr(hash, S, 53);	RNDr(hash, S, 54);	RNDr(hash, S, 55);	RNDr(hash, S, 56);	hash[2] += hash[6] + S1(hash[3]) + Ch(hash[3], hash[4], hash[5])			 + S[57] + sha256_k[57];	hash[1] += hash[5] + S1(hash[2]) + Ch(hash[2], hash[3], hash[4])			 + S[58] + sha256_k[58];	hash[0] += hash[4] + S1(hash[1]) + Ch(hash[1], hash[2], hash[3])			 + S[59] + sha256_k[59];	hash[7] += hash[3] + S1(hash[0]) + Ch(hash[0], hash[1], hash[2])			 + S[60] + sha256_k[60]			 + sha256_h[7];}
开发者ID:nicehash,项目名称:ccminer-sp,代码行数:101,


示例19: MUSH_SHA1_HashBlock

static void MUSH_SHA1_HashBlock(MUSH_SHA1_CONTEXT *p){    int t, j;    UINT32 W[80], a, b, c, d, e, T;    // Prepare Message Schedule, {W sub t}.    //    for (t = 0, j = 0; t <= 15; t++, j += 4)    {        W[t] = (p->block[j  ] << 24)             | (p->block[j+1] << 16)             | (p->block[j+2] <<  8)             | (p->block[j+3]      );    }    for (t = 16; t <= 79; t++)    {        W[t] = ROTL(W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16], 1);    }    a = p->H[0];    b = p->H[1];    c = p->H[2];    d = p->H[3];    e = p->H[4];    for (t =  0; t <= 19; t++)    {        T = ROTL(a,5) + Ch(b,c,d) + e + 0x5A827999 + W[t];        e = d;        d = c;        c = ROTL(b,30);        b = a;        a = T;    }    for (t = 20; t <= 39; t++)    {        T = ROTL(a,5) + Parity(b,c,d) + e + 0x6ED9EBA1 + W[t];        e = d;        d = c;        c = ROTL(b,30);        b = a;        a = T;    }    for (t = 40; t <= 59; t++)    {        T = ROTL(a,5) + Maj(b,c,d) + e + 0x8F1BBCDC + W[t];        e = d;        d = c;        c = ROTL(b,30);        b = a;        a = T;    }    for (t = 60; t <= 79; t++)    {        T = ROTL(a,5) + Parity(b,c,d) + e + 0xCA62C1D6 + W[t];        e = d;        d = c;        c = ROTL(b,30);        b = a;        a = T;    }    p->H[0] += a;    p->H[1] += b;    p->H[2] += c;    p->H[3] += d;    p->H[4] += e;}
开发者ID:RhostMUSH,项目名称:trunk,代码行数:68,


示例20: sha256_process_block

/* Process LEN bytes of BUFFER, accumulating context into CTX.   It is assumed that LEN % 64 == 0.  */static voidsha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx){  const uint32_t *words = buffer;  size_t nwords = len / sizeof (uint32_t);  uint32_t a = ctx->H[0];  uint32_t b = ctx->H[1];  uint32_t c = ctx->H[2];  uint32_t d = ctx->H[3];  uint32_t e = ctx->H[4];  uint32_t f = ctx->H[5];  uint32_t g = ctx->H[6];  uint32_t h = ctx->H[7];  /* First increment the byte count.  FIPS 180-2 specifies the possible     length of the file up to 2^64 bits.  Here we only compute the     number of bytes.  Do a double word increment.  */  ctx->total[0] += len;  if (ctx->total[0] < len)    ++ctx->total[1];  /* Process all bytes in the buffer with 64 bytes in each round of     the loop.  */  while (nwords > 0)    {      uint32_t W[64];      uint32_t a_save = a;      uint32_t b_save = b;      uint32_t c_save = c;      uint32_t d_save = d;      uint32_t e_save = e;      uint32_t f_save = f;      uint32_t g_save = g;      uint32_t h_save = h;      /* Operators defined in FIPS 180-2:4.1.2.  */#define Ch(x, y, z) ((x & y) ^ (~x & z))#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))#define S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22))#define S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25))#define R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3))#define R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10))      /* It is unfortunate that C does not provide an operator for	 cyclic rotation.  Hope the C compiler is smart enough.  */#define CYCLIC(w, s) ((w >> s) | (w << (32 - s)))      /* Compute the message schedule according to FIPS 180-2:6.2.2 step 2.  */      for (unsigned int t = 0; t < 16; ++t)	{	  W[t] = SWAP (*words);	  ++words;	}      for (unsigned int t = 16; t < 64; ++t)	W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16];      /* The actual computation according to FIPS 180-2:6.2.2 step 3.  */      for (unsigned int t = 0; t < 64; ++t)	{	  uint32_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t];	  uint32_t T2 = S0 (a) + Maj (a, b, c);	  h = g;	  g = f;	  f = e;	  e = d + T1;	  d = c;	  c = b;	  b = a;	  a = T1 + T2;	}      /* Add the starting values of the context according to FIPS 180-2:6.2.2	 step 4.  */      a += a_save;      b += b_save;      c += c_save;      d += d_save;      e += e_save;      f += f_save;      g += g_save;      h += h_save;      /* Prepare for the next round.  */      nwords -= 16;    }  /* Put checksum in context given as argument.  */  ctx->H[0] = a;  ctx->H[1] = b;  ctx->H[2] = c;  ctx->H[3] = d;  ctx->H[4] = e;  ctx->H[5] = f;  ctx->H[6] = g;  ctx->H[7] = h;}
开发者ID:1310701102,项目名称:sl4a,代码行数:98,


示例21: print_node

            for (xml_node<Ch> *child = node->first_node(); child; child = child->next_sibling())                out = print_node(out, child, flags, indent);            return out;        }        // Print attributes of the node        template<class OutIt, class Ch>        inline OutIt print_attributes(OutIt out, const xml_node<Ch> *node, int flags)        {			Q_UNUSED(flags)            for (xml_attribute<Ch> *attribute = node->first_attribute(); attribute; attribute = attribute->next_attribute())            {                if (attribute->name() && attribute->value())                {                    // Print attribute name                    *out = Ch(' '), ++out;                    out = copy_chars(attribute->name(), attribute->name() + attribute->name_size(), out);                    *out = Ch('='), ++out;                    // Print attribute value using appropriate quote type                    if (find_char<Ch, Ch('"')>(attribute->value(), attribute->value() + attribute->value_size()))                    {                        *out = Ch('/''), ++out;                        out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('"'), out);                        *out = Ch('/''), ++out;                    }                    else                    {                        *out = Ch('"'), ++out;                        out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('/''), out);                        *out = Ch('"'), ++out;                    }
开发者ID:kehlaaa,项目名称:TradeClient,代码行数:31,


示例22: sha256_transform

static void sha256_transform(u32 *state, const u8 *input){	u32 a, b, c, d, e, f, g, h, t1, t2;	u32 W[64];	int i;	/* load the input */	for (i = 0; i < 16; i++)		LOAD_OP(i, W, input);	/* now blend */	for (i = 16; i < 64; i++)		BLEND_OP(i, W);	/* load the state into our registers */	a=state[0];  b=state[1];  c=state[2];  d=state[3];	e=state[4];  f=state[5];  g=state[6];  h=state[7];	/* now iterate */	t1 = h + e1(e) + Ch(e,f,g) + 0x428a2f98 + W[ 0];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0x71374491 + W[ 1];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0xb5c0fbcf + W[ 2];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0xe9b5dba5 + W[ 3];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0x3956c25b + W[ 4];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0x59f111f1 + W[ 5];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0x923f82a4 + W[ 6];	t2 = e0(c) + Maj(c,d,e);    f+=t1;    b=t1+t2;	t1 = a + e1(f) + Ch(f,g,h) + 0xab1c5ed5 + W[ 7];	t2 = e0(b) + Maj(b,c,d);    e+=t1;    a=t1+t2;	t1 = h + e1(e) + Ch(e,f,g) + 0xd807aa98 + W[ 8];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0x12835b01 + W[ 9];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0x243185be + W[10];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0x550c7dc3 + W[11];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0x72be5d74 + W[12];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0x80deb1fe + W[13];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0x9bdc06a7 + W[14];	t2 = e0(c) + Maj(c,d,e);    f+=t1;    b=t1+t2;	t1 = a + e1(f) + Ch(f,g,h) + 0xc19bf174 + W[15];	t2 = e0(b) + Maj(b,c,d);    e+=t1;    a=t1+t2;	t1 = h + e1(e) + Ch(e,f,g) + 0xe49b69c1 + W[16];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0xefbe4786 + W[17];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0x0fc19dc6 + W[18];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0x240ca1cc + W[19];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0x2de92c6f + W[20];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0x4a7484aa + W[21];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0x5cb0a9dc + W[22];	t2 = e0(c) + Maj(c,d,e);    f+=t1;    b=t1+t2;	t1 = a + e1(f) + Ch(f,g,h) + 0x76f988da + W[23];	t2 = e0(b) + Maj(b,c,d);    e+=t1;    a=t1+t2;	t1 = h + e1(e) + Ch(e,f,g) + 0x983e5152 + W[24];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0xa831c66d + W[25];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0xb00327c8 + W[26];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0xbf597fc7 + W[27];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0xc6e00bf3 + W[28];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0xd5a79147 + W[29];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0x06ca6351 + W[30];	t2 = e0(c) + Maj(c,d,e);    f+=t1;    b=t1+t2;	t1 = a + e1(f) + Ch(f,g,h) + 0x14292967 + W[31];	t2 = e0(b) + Maj(b,c,d);    e+=t1;    a=t1+t2;	t1 = h + e1(e) + Ch(e,f,g) + 0x27b70a85 + W[32];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0x2e1b2138 + W[33];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0x4d2c6dfc + W[34];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0x53380d13 + W[35];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0x650a7354 + W[36];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0x766a0abb + W[37];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0x81c2c92e + W[38];//.........这里部分代码省略.........
开发者ID:GAXUSXX,项目名称:G935FGaXusKernel2,代码行数:101,


示例23: sha512_transform

static void sha512_transform(uint64_t *state, const uint8_t buffer[128]){    uint64_t a, b, c, d, e, f, g, h;    uint64_t block[80];    uint64_t T1;    int i;    a = state[0];    b = state[1];    c = state[2];    d = state[3];    e = state[4];    f = state[5];    g = state[6];    h = state[7];#if CONFIG_SMALL    for (i = 0; i < 80; i++) {        uint64_t T2;        if (i < 16)            T1 = blk0(i);        else            T1 = blk(i);        T1 += h + Sigma1_512(e) + Ch(e, f, g) + K512[i];        T2 = Sigma0_512(a) + Maj(a, b, c);        h = g;        g = f;        f = e;        e = d + T1;        d = c;        c = b;        b = a;        a = T1 + T2;    }#else    for (i = 0; i < 16 - 7;) {        ROUND512_0_TO_15(a, b, c, d, e, f, g, h);        ROUND512_0_TO_15(h, a, b, c, d, e, f, g);        ROUND512_0_TO_15(g, h, a, b, c, d, e, f);        ROUND512_0_TO_15(f, g, h, a, b, c, d, e);        ROUND512_0_TO_15(e, f, g, h, a, b, c, d);        ROUND512_0_TO_15(d, e, f, g, h, a, b, c);        ROUND512_0_TO_15(c, d, e, f, g, h, a, b);        ROUND512_0_TO_15(b, c, d, e, f, g, h, a);    }    for (; i < 80 - 7;) {        ROUND512_16_TO_80(a, b, c, d, e, f, g, h);        ROUND512_16_TO_80(h, a, b, c, d, e, f, g);        ROUND512_16_TO_80(g, h, a, b, c, d, e, f);        ROUND512_16_TO_80(f, g, h, a, b, c, d, e);        ROUND512_16_TO_80(e, f, g, h, a, b, c, d);        ROUND512_16_TO_80(d, e, f, g, h, a, b, c);        ROUND512_16_TO_80(c, d, e, f, g, h, a, b);        ROUND512_16_TO_80(b, c, d, e, f, g, h, a);    }#endif    state[0] += a;    state[1] += b;    state[2] += c;    state[3] += d;    state[4] += e;    state[5] += f;    state[6] += g;    state[7] += h;}
开发者ID:AronVietti,项目名称:FFmpeg,代码行数:65,


示例24: create_escapes

 std::basic_string<Ch> create_escapes(const std::basic_string<Ch> &s) {     std::basic_string<Ch> result;     typename std::basic_string<Ch>::const_iterator b = s.begin();     typename std::basic_string<Ch>::const_iterator e = s.end();     while (b != e)     {         if (*b == Ch('/0')) result += Ch('//'), result += Ch('0');         else if (*b == Ch('/a')) result += Ch('//'), result += Ch('a');         else if (*b == Ch('/b')) result += Ch('//'), result += Ch('b');         else if (*b == Ch('/f')) result += Ch('//'), result += Ch('f');         else if (*b == Ch('/n')) result += Ch('//'), result += Ch('n');         else if (*b == Ch('/r')) result += Ch('//'), result += Ch('r');         else if (*b == Ch('/v')) result += Ch('//'), result += Ch('v');         else if (*b == Ch('"')) result += Ch('//'), result += Ch('"');         else if (*b == Ch('//')) result += Ch('//'), result += Ch('//');         else             result += *b;         ++b;     }     return result; }
开发者ID:craton-,项目名称:php_mapnik,代码行数:22,


示例25: print_doctype_node

 inline OutIt print_doctype_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) {     assert(node->type() == node_doctype);     if (!(flags & print_no_indenting))         out = fill_chars(out, indent, Ch('/t'));     *out = Ch('<'), ++out;     *out = Ch('!'), ++out;     *out = Ch('D'), ++out;     *out = Ch('O'), ++out;     *out = Ch('C'), ++out;     *out = Ch('T'), ++out;     *out = Ch('Y'), ++out;     *out = Ch('P'), ++out;     *out = Ch('E'), ++out;     *out = Ch(' '), ++out;     out = copy_chars(node->value(), node->value() + node->value_size(), out);     *out = Ch('>'), ++out;     return out; }
开发者ID:281627166,项目名称:NoahGameFrame,代码行数:19,


示例26: HashSHA1Block

void HashSHA1Block(void* hash_block, SHA1_Context* ctx){	unsigned int a,b,c,d,e,T,i;	unsigned char* block = (unsigned char*)hash_block;	unsigned int w[0x50];	a = ctx->h0;	b = ctx->h1;	c = ctx->h2;	d = ctx->h3;	e = ctx->h4;	for (i = 0; i < 16; i++) w[i] = BSWAP(*(unsigned int*)(block + i * 4));	for (i = 16; i < 80; i++) w[i] = ROTL( w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16], 1);		for (i = 0; i < 20; i++)	{		T = ROTL(a,5) + Ch(b,c,d) + e + sha1_constant[0] + w[i];		e = d;		d = c;		c = ROTL(b,30);		b = a;		a = T;	}	for (i=20;i<40;i++)	{		T = ROTL(a,5) + Parity(b,c,d) + e + sha1_constant[1] + w[i];		e = d;		d = c;		c = ROTL(b,30);		b = a;		a = T;	}	for (i=40;i<60;i++)	{		T = ROTL(a,5) + Maj(b,c,d) + e + sha1_constant[2] + w[i];		e = d;		d = c;		c = ROTL(b,30);		b = a;		a = T;	}	for (i=60;i<80;i++)	{		T = ROTL(a,5) + Parity(b,c,d) + e + sha1_constant[3] + w[i];		e = d;		d = c;		c = ROTL(b,30);		b = a;		a = T;	}	ctx->h0 += a;	ctx->h1 += b;	ctx->h2 += c;	ctx->h3 += d;	ctx->h4 += e;	a = b = c = d = e = T = 0;	memset(w, 0, 0x140);}
开发者ID:Alex12235,项目名称:interactive-text-hooker-andys,代码行数:62,


示例27: SHA256_Transform

static void SHA256_Transform(sha256_ctx* context, const sha2_word32* data) {	sha2_word32	a, b, c, d, e, f, g, h, s0, s1;	sha2_word32	T1, T2, *W256;	uint8_t		j;	W256 = (sha2_word32*)context->buffer;	/* Initialize registers with the prev. intermediate value */	a = context->state[0];	b = context->state[1];	c = context->state[2];	d = context->state[3];	e = context->state[4];	f = context->state[5];	g = context->state[6];	h = context->state[7];  	j = 0;	do {		/* Copy data while converting to host byte order */        READ_U32(W256[j],data++);		/* Apply the SHA-256 compression function to update a..h */		T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j];		T2 = Sigma0_256(a) + Maj(a, b, c);		h = g;		g = f;		f = e;		e = d + T1;		d = c;		c = b;		b = a;		a = T1 + T2;		j++;	} while (j < 16);	do {		/* Part of the message block expansion: */		s0 = W256[(j+1)&0x0f];		s0 = sigma0_256(s0);		s1 = W256[(j+14)&0x0f];			s1 = sigma1_256(s1);		/* Apply the SHA-256 compression function to update a..h */		T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0);		T2 = Sigma0_256(a) + Maj(a, b, c);		h = g;		g = f;		f = e;		e = d + T1;		d = c;		c = b;		b = a;		a = T1 + T2;		j++;	} while (j < 64);	/* Compute the current intermediate hash value */	context->state[0] += a;	context->state[1] += b;	context->state[2] += c;	context->state[3] += d;	context->state[4] += e;	context->state[5] += f;	context->state[6] += g;	context->state[7] += h;	/* Clean up */	a = b = c = d = e = f = g = h = T1 = T2 = 0;}
开发者ID:BridgeHill,项目名称:unabto,代码行数:73,


示例28: SHA256Transform

static voidSHA256Transform(u32 *state, const u8 *input){	u32 a, b, c, d, e, f, g, h, t1, t2;	u32 W[64];#if !defined(CONFIG_DIGEST_HASH)	int i;	/* load the input */	LOAD_OP( 0);  LOAD_OP( 1);  LOAD_OP( 2);  LOAD_OP( 3);	LOAD_OP( 4);  LOAD_OP( 5);  LOAD_OP( 6);  LOAD_OP( 7);	LOAD_OP( 8);  LOAD_OP( 9);  LOAD_OP(10);  LOAD_OP(11);	LOAD_OP(12);  LOAD_OP(13);  LOAD_OP(14);  LOAD_OP(15);	/* now blend */	for (i=16; i<64; i+=8) {		BLEND_OP(i  );  BLEND_OP(i+1);  BLEND_OP(i+2);  BLEND_OP(i+3);		BLEND_OP(i+4);  BLEND_OP(i+5);  BLEND_OP(i+6);  BLEND_OP(i+7);	}	/* load the state into our registers */	a=state[0];  b=state[1];  c=state[2];  d=state[3];	e=state[4];  f=state[5];  g=state[6];  h=state[7];  	/* now iterate */	for (i=0; i<64; i+=8) {		t1 = h + e1(e) + Ch(e,f,g) + sha256_K[i  ] + W[i  ];		t2 = e0(a) + Maj(a,b,c);   d+=t1;  h=t1+t2;		t1 = g + e1(d) + Ch(d,e,f) + sha256_K[i+1] + W[i+1];		t2 = e0(h) + Maj(h,a,b);   c+=t1;  g=t1+t2;		t1 = f + e1(c) + Ch(c,d,e) + sha256_K[i+2] + W[i+2];		t2 = e0(g) + Maj(g,h,a);   b+=t1;  f=t1+t2;		t1 = e + e1(b) + Ch(b,c,d) + sha256_K[i+3] + W[i+3];		t2 = e0(f) + Maj(f,g,h);   a+=t1;  e=t1+t2;		t1 = d + e1(a) + Ch(a,b,c) + sha256_K[i+4] + W[i+4];		t2 = e0(e) + Maj(e,f,g);   h+=t1;  d=t1+t2;		t1 = c + e1(h) + Ch(h,a,b) + sha256_K[i+5] + W[i+5];		t2 = e0(d) + Maj(d,e,f);   g+=t1;  c=t1+t2;		t1 = b + e1(g) + Ch(g,h,a) + sha256_K[i+6] + W[i+6];		t2 = e0(c) + Maj(c,d,e);   f+=t1;  b=t1+t2;		t1 = a + e1(f) + Ch(f,g,h) + sha256_K[i+7] + W[i+7];		t2 = e0(b) + Maj(b,c,d);   e+=t1;  a=t1+t2;	}#else /* CONFIG_DIGEST_FAST */	/* load the input */	LOAD_OP( 0);  LOAD_OP( 1);  LOAD_OP( 2);  LOAD_OP( 3);	LOAD_OP( 4);  LOAD_OP( 5);  LOAD_OP( 6);  LOAD_OP( 7);	LOAD_OP( 8);  LOAD_OP( 9);  LOAD_OP(10);  LOAD_OP(11);	LOAD_OP(12);  LOAD_OP(13);  LOAD_OP(14);  LOAD_OP(15);	/* now blend */	BLEND_OP(16);  BLEND_OP(17);  BLEND_OP(18);  BLEND_OP(19);	BLEND_OP(20);  BLEND_OP(21);  BLEND_OP(22);  BLEND_OP(23);	BLEND_OP(24);  BLEND_OP(25);  BLEND_OP(26);  BLEND_OP(27);	BLEND_OP(28);  BLEND_OP(29);  BLEND_OP(30);  BLEND_OP(31);	BLEND_OP(32);  BLEND_OP(33);  BLEND_OP(34);  BLEND_OP(35);	BLEND_OP(36);  BLEND_OP(37);  BLEND_OP(38);  BLEND_OP(39);	BLEND_OP(40);  BLEND_OP(41);  BLEND_OP(42);  BLEND_OP(43);	BLEND_OP(44);  BLEND_OP(45);  BLEND_OP(46);  BLEND_OP(47);	BLEND_OP(48);  BLEND_OP(49);  BLEND_OP(50);  BLEND_OP(51);	BLEND_OP(52);  BLEND_OP(53);  BLEND_OP(54);  BLEND_OP(55);	BLEND_OP(56);  BLEND_OP(57);  BLEND_OP(58);  BLEND_OP(59);	BLEND_OP(60);  BLEND_OP(61);  BLEND_OP(62);  BLEND_OP(63);    	/* load the state into our registers */	a=state[0];  b=state[1];  c=state[2];  d=state[3];	e=state[4];  f=state[5];  g=state[6];  h=state[7];	/* now iterate */	t1 = h + e1(e) + Ch(e,f,g) + 0x428a2f98 + W[ 0];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0x71374491 + W[ 1];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0xb5c0fbcf + W[ 2];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0xe9b5dba5 + W[ 3];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0x3956c25b + W[ 4];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0x59f111f1 + W[ 5];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0x923f82a4 + W[ 6];	t2 = e0(c) + Maj(c,d,e);    f+=t1;    b=t1+t2;	t1 = a + e1(f) + Ch(f,g,h) + 0xab1c5ed5 + W[ 7];	t2 = e0(b) + Maj(b,c,d);    e+=t1;    a=t1+t2;	t1 = h + e1(e) + Ch(e,f,g) + 0xd807aa98 + W[ 8];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0x12835b01 + W[ 9];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0x243185be + W[10];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0x550c7dc3 + W[11];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0x72be5d74 + W[12];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0x80deb1fe + W[13];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0x9bdc06a7 + W[14];//.........这里部分代码省略.........
开发者ID:jameshilliard,项目名称:A90-9100VM15-V1.03.05.04,代码行数:101,



注:本文中的Ch函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ Change函数代码示例
C++ CfReadLine函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。