         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: ->
        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
    
    ###* ECIES ###
    get_shared_secret:(public_key)->

    ### </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]

