     ### </helper_functions> ###
 
 module.exports = PrivateKey
+
+pad32 = (buf) ->
+    pad = 32 - buf.length
+    zeros = ""
+    zeros += "00" for i in [0...pad] by 1
+    Buffer.concat [new Buffer(zeros, 'hex'), buf]
+

        assert.deepEqual checksum, new_checksum #, 'Invalid checksum'
        private_key = private_key.slice 1
        PrivateKey.fromBuffer private_key
        
    toWif: ->
        private_key = @toBuffer()
        # checksum includes the version

        PublicKey.fromPoint @toPublicKeyPoint()
    
    toBuffer: ->
        pad32 @d.toBuffer()
    
    ###* ECIES ###
    get_shared_secret:(public_key)->
