资源简介

以太坊(英语:Ethereum)是一个开源的有智能合约功能的公共区块链平台。通过其专用加密货币以太币(Ether,又称“以太币”)提供去中心化的虚拟机,这是其最新的源代码,是go语言版本。

资源截图

代码片段和文件信息

/**********************************************************************
 * Copyright (c) 2015 Pieter Wuille                                   *
 * Distributed under the MIT software license see the accompanying   *
 * file COPYING or http://www.opensource.org/licenses/mit-license.php.*
 **********************************************************************/

#include 
#include 

#include “lax_der_parsing.h“

int ecdsa_signature_parse_der_lax(const secp256k1_context* ctx secp256k1_ecdsa_signature* sig const unsigned char *input size_t inputlen) {
    size_t rpos rlen spos slen;
    size_t pos = 0;
    size_t lenbyte;
    unsigned char tmpsig[64] = {0};
    int overflow = 0;

    /* Hack to initialize sig with a correctly-parsed but invalid signature. */
    secp256k1_ecdsa_signature_parse_compact(ctx sig tmpsig);

    /* Sequence tag byte */
    if (pos == inputlen || input[pos] != 0x30) {
        return 0;
    }
    pos++;

    /* Sequence length bytes */
    if (pos == inputlen) {
        return 0;
    }
    lenbyte = input[pos++];
    if (lenbyte & 0x80) {
        lenbyte -= 0x80;
        if (pos + lenbyte > inputlen) {
            return 0;
        }
        pos += lenbyte;
    }

    /* Integer tag byte for R */
    if (pos == inputlen || input[pos] != 0x02) {
        return 0;
    }
    pos++;

    /* Integer length for R */
    if (pos == inputlen) {
        return 0;
    }
    lenbyte = input[pos++];
    if (lenbyte & 0x80) {
        lenbyte -= 0x80;
        if (pos + lenbyte > inputlen) {
            return 0;
        }
        while (lenbyte > 0 && input[pos] == 0) {
            pos++;
            lenbyte--;
        }
        if (lenbyte >= sizeof(size_t)) {
            return 0;
        }
        rlen = 0;
        while (lenbyte > 0) {
            rlen = (rlen << 8) + input[pos];
            pos++;
            lenbyte--;
        }
    } else {
        rlen = lenbyte;
    }
    if (rlen > inputlen - pos) {
        return 0;
    }
    rpos = pos;
    pos += rlen;

    /* Integer tag byte for S */
    if (pos == inputlen || input[pos] != 0x02) {
        return 0;
    }
    pos++;

    /* Integer length for S */
    if (pos == inputlen) {
        return 0;
    }
    lenbyte = input[pos++];
    if (lenbyte & 0x80) {
        lenbyte -= 0x80;
        if (pos + lenbyte > inputlen) {
            return 0;
        }
        while (lenbyte > 0 && input[pos] == 0) {
            pos++;
            lenbyte--;
        }
        if (lenbyte >= sizeof(size_t)) {
            return 0;
        }
        slen = 0;
        while (lenbyte > 0) {
            slen = (slen << 8) + input[pos];
            pos++;
            lenbyte--;
        }
    } else {
        slen = lenbyte;
    }
    if (slen > inputlen - pos) {
        return 0;
    }
    spos = pos;
    pos += slen;

    /* Ignore leading zeroes in R */
    while (rlen > 0 && input[rpos] == 0) {
        rlen--;
        rpos++;
    }
    /* Copy R value */
    if (rlen > 3

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-03-28 12:35  go-ethereum-master\
     文件          98  2018-03-28 12:35  go-ethereum-master\.dockerignore
     文件          66  2018-03-28 12:35  go-ethereum-master\.gitattributes
     目录           0  2018-03-28 12:35  go-ethereum-master\.github\
     文件         392  2018-03-28 12:35  go-ethereum-master\.github\CODEOWNERS
     文件         671  2018-03-28 12:35  go-ethereum-master\.github\CONTRIBUTING.md
     文件         468  2018-03-28 12:35  go-ethereum-master\.github\ISSUE_TEMPLATE.md
     文件         625  2018-03-28 12:35  go-ethereum-master\.github\no-response.yml
     文件         684  2018-03-28 12:35  go-ethereum-master\.github\stale.yml
     文件         760  2018-03-28 12:35  go-ethereum-master\.gitignore
     文件          84  2018-03-28 12:35  go-ethereum-master\.gitmodules
     文件        3236  2018-03-28 12:35  go-ethereum-master\.mailmap
     文件        8081  2018-03-28 12:35  go-ethereum-master\.travis.yml
     文件        6477  2018-03-28 12:35  go-ethereum-master\AUTHORS
     文件       32397  2018-03-28 12:35  go-ethereum-master\COPYING
     文件        7651  2018-03-28 12:35  go-ethereum-master\COPYING.LESSER
     文件         433  2018-03-28 12:35  go-ethereum-master\Dockerfile
     文件         417  2018-03-28 12:35  go-ethereum-master\Dockerfile.alltools
     文件        5496  2018-03-28 12:35  go-ethereum-master\Makefile
     文件       17879  2018-03-28 12:35  go-ethereum-master\README.md
     文件           6  2018-03-28 12:35  go-ethereum-master\VERSION
     目录           0  2018-03-28 12:35  go-ethereum-master\accounts\
     目录           0  2018-03-28 12:35  go-ethereum-master\accounts\abi\
     文件        4201  2018-03-28 12:35  go-ethereum-master\accounts\abi\abi.go
     文件       26995  2018-03-28 12:35  go-ethereum-master\accounts\abi\abi_test.go
     文件        8801  2018-03-28 12:35  go-ethereum-master\accounts\abi\argument.go
     目录           0  2018-03-28 12:35  go-ethereum-master\accounts\abi\bind\
     文件        2122  2018-03-28 12:35  go-ethereum-master\accounts\abi\bind\auth.go
     文件        5440  2018-03-28 12:35  go-ethereum-master\accounts\abi\bind\backend.go
     目录           0  2018-03-28 12:35  go-ethereum-master\accounts\abi\bind\backends\
     文件       16218  2018-03-28 12:35  go-ethereum-master\accounts\abi\bind\backends\simulated.go
............此处省略2744个文件信息

评论

共有 条评论