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 | |
|---|---|
|
|
| File size: 416 bytes | |
| Line | |
|---|---|
| 1 | """ |
| 2 | Ported to Python 3. |
| 3 | """ |
| 4 | |
| 5 | from six import ensure_text |
| 6 | from foolscap import base32 |
| 7 | |
| 8 | |
| 9 | def 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 | |
| 17 | def 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.
