Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

What is the meaining of ord(input) in RLP code example? #687

Open
Bowfish opened this issue Feb 14, 2020 · 0 comments
Open

What is the meaining of ord(input) in RLP code example? #687

Bowfish opened this issue Feb 14, 2020 · 0 comments

Comments

@Bowfish
Copy link

Bowfish commented Feb 14, 2020

In the RLP encoding section there is this pseudo code. What does ord(input) < 0x80 in the third line mean? What would be the c or c++ equivalent for this?

def rlp_encode(input):
    if isinstance(input,str):
        if len(input) == 1 and ord(input) < 0x80: return input
        else: return encode_length(len(input), 0x80) + input
    elif isinstance(input,list):
        output = ''
        for item in input: output += rlp_encode(item)
        return encode_length(len(output), 0xc0) + output
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant