Make {pf_key,policy_crash}_test pass on both python2 and python3.

Bug: 243057700
Test: tests pass on bramble with both python versions
Change-Id: Iccbc9b7b56391b20aa856952794955abb7323120
diff --git a/net/test/pf_key_test.py b/net/test/pf_key_test.py
index 97cc039..52981a7 100755
--- a/net/test/pf_key_test.py
+++ b/net/test/pf_key_test.py
@@ -18,13 +18,14 @@
 from socket import *
 import unittest
 
+import binascii
 import csocket
 import pf_key
 import xfrm
 
-ENCRYPTION_KEY = ("308146eb3bd84b044573d60f5a5fd159"
-                  "57c7d4fe567a2120f35bae0f9869ec22".decode("hex"))
-AUTH_KEY = "af442892cdcd0ef650e9c299f9a8436a".decode("hex")
+ENCRYPTION_KEY = binascii.unhexlify("308146eb3bd84b044573d60f5a5fd159"
+                                    "57c7d4fe567a2120f35bae0f9869ec22")
+AUTH_KEY = binascii.unhexlify("af442892cdcd0ef650e9c299f9a8436a")
 
 
 class PfKeyTest(unittest.TestCase):
diff --git a/net/test/policy_crash_test.py b/net/test/policy_crash_test.py
index ad1b92a..2771475 100755
--- a/net/test/policy_crash_test.py
+++ b/net/test/policy_crash_test.py
@@ -70,6 +70,7 @@
 
 # ----------------------------------------------------------------------
 
+import binascii
 import os
 import socket
 import unittest
@@ -126,8 +127,8 @@
          + pkt2_frag_payload)
 
     s = socket.socket(socket.AF_INET6, socket.SOCK_RAW, socket.IPPROTO_RAW)
-    s.sendto(pkt1.decode('hex'), ('::1', 0))
-    s.sendto(pkt2.decode('hex'), ('::1', 0))
+    s.sendto(binascii.unhexlify(pkt1), ('::1', 0))
+    s.sendto(binascii.unhexlify(pkt2), ('::1', 0))
     s.close()