From 5f6443590909c11994d6718312f6db1c1d6659f1 Mon Sep 17 00:00:00 2001
From: Ben Adida <ben@adida.net>
Date: Wed, 16 Mar 2011 21:51:59 -0700
Subject: [PATCH] added encoding of voter id before hashing

---
 helios/models.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/helios/models.py b/helios/models.py
index 5ac4f38..04a7f64 100644
--- a/helios/models.py
+++ b/helios/models.py
@@ -808,9 +808,14 @@ class Voter(HeliosModel):
     if self.voter_login_id:
       # for backwards compatibility with v3.0, and since it doesn't matter
       # too much if we hash the email or the unique login ID here.
-      return utils.hash_b64(self.voter_login_id)
+      value_to_hash = self.voter_login_id
     else:
-      return utils.hash_b64(self.voter_id)
+      value_to_hash = self.voter_id
+
+    try:
+      return utils.hash_b64(value_to_hash)
+    except:
+      return utils.hash_b64(value_to_hash.encode('latin-1'))
 
   @property
   def voter_type(self):
-- 
GitLab