diff --git a/src/crypto/public_key/elliptic/ecdh.js b/src/crypto/public_key/elliptic/ecdh.js
index 76df6b79..af8ab3ff 100644
--- a/src/crypto/public_key/elliptic/ecdh.js
+++ b/src/crypto/public_key/elliptic/ecdh.js
@@ -42,13 +42,6 @@ import util from '../../../util.js';
 import type_kdf_params from '../../../type/kdf_params.js';
 import type_oid from '../../../type/oid.js';
 
-function hex2Uint8Array(hex) {
-  var result = new Uint8Array(hex.length/2);
-  for (var k=0; k<hex.length/2; k++) {
-    result[k] = parseInt(hex.substr(2*k, 2), 16);
-  }
-  return result;
-}
 
 // Build Param for ECDH algorithm (RFC 6637)
 function buildEcdhParam(public_algo, oid, cipher_algo, hash_algo, fingerprint) {
@@ -72,6 +65,7 @@ function kdf(hash_algo, X, length, param) {
   ])).subarray(0, length);
 }
 
+
 /**
  * Encrypt and wrap a session key
  *
@@ -84,7 +78,7 @@ function kdf(hash_algo, X, length, param) {
  * @return {{V: BigInteger, C: Uint8Array}}  Returns ephemeral key and encoded session key
  */
 function encrypt(oid, cipher_algo, hash_algo, m, R, fingerprint) {
-  fingerprint = hex2Uint8Array(fingerprint);
+  fingerprint = util.hex2Uint8Array(fingerprint);
   const param = buildEcdhParam(enums.publicKey.ecdh, oid, cipher_algo, hash_algo, fingerprint);
   const curve = curves.get(oid);
   cipher_algo = enums.read(enums.symmetric, cipher_algo);
@@ -112,7 +106,7 @@ function encrypt(oid, cipher_algo, hash_algo, m, R, fingerprint) {
  * @return {Uint8Array}               Value derived from session
  */
 function decrypt(oid, cipher_algo, hash_algo, V, C, r, fingerprint) {
-  fingerprint = hex2Uint8Array(fingerprint);
+  fingerprint = util.hex2Uint8Array(fingerprint);
   const param = buildEcdhParam(enums.publicKey.ecdh, oid, cipher_algo, hash_algo, fingerprint);
   const curve = curves.get(oid);
   cipher_algo = enums.read(enums.symmetric, cipher_algo);
diff --git a/src/util.js b/src/util.js
index f2d8bdef..8f9573ac 100644
--- a/src/util.js
+++ b/src/util.js
@@ -169,6 +169,15 @@ export default {
     return str;
   },
 
+
+  hex2Uint8Array: function (hex) {
+    var result = new Uint8Array(hex.length/2);
+    for (var k=0; k<hex.length/2; k++) {
+      result[k] = parseInt(hex.substr(2*k, 2), 16);
+    }
+    return result;
+  },
+
   /**
    * Creating a hex string from an binary array of integers (0..255)
    * @param {String} str Array of bytes to convert