source: trunk/src/allmydata/util/idlib.py

Last change on this file was 1cfe843d, checked in by Alexandre Detiste <alexandre.detiste@…>, at 2024-02-22T23:40:25Z

more python2 removal

  • Property mode set to 100644
File size: 416 bytes
Line 
1"""
2Ported to Python 3.
3"""
4
5from six import ensure_text
6from foolscap import base32
7
8
9def nodeid_b2a(nodeid):
10    """
11    We display nodeids using the same base32 alphabet that Foolscap uses.
12
13    Returns a Unicode string.
14    """
15    return ensure_text(base32.encode(nodeid))
16
17def shortnodeid_b2a(nodeid):
18    """
19    Short version of nodeid_b2a() output, Unicode string.
20    """
21    return nodeid_b2a(nodeid)[:8]
Note: See TracBrowser for help on using the repository browser.