         PublicKey.fromPoint @toPublicKeyPoint()
     
     toBuffer: ->
-        buf = @d.toBuffer()
-        if buf.length isnt 32
-            len = buf.length
-            pad = 32 - len
-            #DEBUG console.log('... zeros',pad)
-            zeros = ""
-            zeros += "0" for i in [0...pad] by 1
-            buf = Buffer.concat [new Buffer(zeros), buf]
-            #DEBUG console.log "BigInteger toBuffer was #{len} bytes and was padded to #{buf.length} bytes"
-        buf
+        pad32 @d.toBuffer()
     
     ###* ECIES ###
     get_shared_secret:(public_key)->

    ### </helper_functions> ###

module.exports = PrivateKey

        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
