diff --git a/django/utils/crypto.py b/django/utils/crypto.py
index 1587bfc..fc0976c 100644
--- a/django/utils/crypto.py
+++ b/django/utils/crypto.py
@@ -38,5 +38,10 @@ def constant_time_compare(val1, val2):
         return False
     result = 0
     for x, y in zip(val1, val2):
-        result |= ord(x) ^ ord(y)
+        #in Python 3 iterating a bte string will already return ints.
+        if not isinstance(x, int):
+            x = ord(x)
+        if not isinstance(y, int):
+            y = ord(y)
+        result |= x ^ y
     return result == 0
