This is an automated email from the ASF dual-hosted git repository. gstein pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/steve.git
commit e8e2e019d1a715940cca86a660c50f67b1737b28 Author: Greg Stein <[email protected]> AuthorDate: Sun May 29 17:40:07 2022 -0500 add helper to create new ElectionID values --- v3/steve/election.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/v3/steve/election.py b/v3/steve/election.py index 3452295..30670f5 100644 --- a/v3/steve/election.py +++ b/v3/steve/election.py @@ -65,3 +65,13 @@ class Election: for_table('issues', self.c_salt_issue) for_table('record', self.c_salt_record) + + +def new_eid(): + "Create a new ElectionID." + + # Use 4 bytes of a salt, for 32 bits. + b = crypto.gen_salt()[:4] + + # Format into 8 hex characters. + return f'{b[0]:02x}{b[1]:02x}{b[2]:02x}{b[3]:02x}'
