Post
Topic
Board Bitcoin Technical Support
Re: Encrypted wallet.dat, lost password, any solutions?
by
Revalin
on 15/12/2013, 00:44:34 UTC
i've lost my PTS & DTC wallet psw (The psw is the same at both) like bounty i offer 30% of my pts & 25% of my DTC!
i remember it but when i try to put it the wallet give a error
The psw was Ctrl+c & ctrl+v form a wikipedia page so i'm sure at 100% it is. but maybe i'm missing a space or something like that...thanks who will pm me!

You should check if that page has been edited.  Smiley

If that doesn't work you can try the standard double-typo script:

Code:
#!/usr/bin/ruby -w
require 'net/http'
require 'json'

passphrase = 'oops i forgot'
$rpc_pass = "some-password"

def test(passphrase)
  puts passphrase.inspect
  request = Net::HTTP::Post.new("/")
  request.basic_auth "", $rpc_pass
  request.body = { method:"walletpassphrase", params:[passphrase, 1] }.to_json
  response = Net::HTTP.new("localhost", 8332).request(request)
  if response.code == "401" ; puts "Incorrect RPC user/pass" ; exit 1 ; end
  ret = JSON.parse response.body
  if ret["error"].nil? ; puts "\nFound it! #{passphrase.inspect}" ; exit ; end
  return if ret["error"]["code"] == -14 # wrong passphrase
  raise "WTF? #{ret.inspect}"
end

def scramble(passphrase)
  characters = " !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
  list = []

  # transpose adjacent chars
  (passphrase.length - 1).times do |i|
    testphrase = passphrase.dup
    testphrase[i] = passphrase[i+1]
    testphrase[i+1] = passphrase[i]
    list << testphrase
  end

  # delete one char
  passphrase.length.times do |i|
    testphrase = passphrase.dup
    testphrase = testphrase[0,i] + testphrase[(i+1)..-1]
    list << testphrase
  end

  # substitutute one char
  passphrase.length.times do |i|
    characters.chars.each do |c|
      testphrase = passphrase.dup
      testphrase[i] = c
      list << testphrase
    end
  end

  # insert one char
  (passphrase.length + 1).times do |i|
    characters.chars.each do |c|
      testphrase = passphrase.dup
      testphrase.insert(i, c)
      list << testphrase
    end
  end

  return list.uniq
end

list1 = scramble(passphrase)
list1.each { |i| test i }
list1.each { |i| scramble(i).each { |j| test j }}
puts "No luck."
exit 1

Instructions are here:  https://bitcointalk.org/index.php?topic=85495.msg3746636#msg3746636
And here:  https://bitcointalk.org/index.php?topic=85495.msg3882236#msg3882236

Protoshares uses a different RPC port so either change it in the script above or start protoshares with -rpcport=8332 in addition to -rpcpassword=some-password .

Give it a try, and we'll help you get it working if you get stuck.