diff --git a/src/common/stanza_session.py b/src/common/stanza_session.py
index 439aa63d590f33f7cd5cfd53bde22a213ed04f9e..411a300c9418e37e9ee53983d1cae37b78be412a 100644
--- a/src/common/stanza_session.py
+++ b/src/common/stanza_session.py
@@ -952,7 +952,7 @@ class EncryptedStanzaSession(ArchivingStanzaSession):
 
             if not rshashes:
                 # we've never spoken before, but we'll pretend we have
-                rshash_size = self.hash_alg().digest_size
+                rshash_size = int(self.hash_alg().digest_size)
                 rshashes.append(crypto.random_bytes(rshash_size))
 
             rshashes = [base64.b64encode(rshash).decode('utf-8') for rshash in \