{"action":"created","issue":{"url":"https://api.github.com/repos/tugrul/node-mcrypt/issues/35","labels_url":"https://api.github.com/repos/tugrul/node-mcrypt/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/tugrul/node-mcrypt/issues/35/comments","events_url":"https://api.github.com/repos/tugrul/node-mcrypt/issues/35/events","html_url":"https://github.com/tugrul/node-mcrypt/issues/35","id":113818276,"number":35,"title":"decrypt text encrypted through php encrypt","user":{"login":"pmaganti","id":5118497,"avatar_url":"https://avatars.githubusercontent.com/u/5118497?v=3","gravatar_id":"","url":"https://api.github.com/users/pmaganti","html_url":"https://github.com/pmaganti","followers_url":"https://api.github.com/users/pmaganti/followers","following_url":"https://api.github.com/users/pmaganti/following{/other_user}","gists_url":"https://api.github.com/users/pmaganti/gists{/gist_id}","starred_url":"https://api.github.com/users/pmaganti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmaganti/subscriptions","organizations_url":"https://api.github.com/users/pmaganti/orgs","repos_url":"https://api.github.com/users/pmaganti/repos","events_url":"https://api.github.com/users/pmaganti/events{/privacy}","received_events_url":"https://api.github.com/users/pmaganti/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-28T13:12:28Z","updated_at":"2015-11-10T14:07:45Z","closed_at":"2015-11-10T14:07:45Z","body":"We are re-writing our php app to node js app and trying to decrypt the password which is encrypted using php encrypt by twofish.\r\n\r\n```\r\n$this->load->library('encrypt'); \r\n$this->encrypt->set_cipher(MCRYPT_TWOFISH); \r\n$encodedPass = $this->encrypt->encode($_POST['password']);\r\n```\r\nMode defaulted to cbc.\r\n\r\nHere is my decrypt code using in node js:\r\n```\r\n        var ivAndCiphertext = new Buffer(ENCRYPTED_PASSWORD, 'base64');\r\n        var twofishCbc = new MCrypt('twofish', 'cbc');\r\n        var ivSize = twofishCbc.getIvSize();\r\n        var iv = new Buffer(ivSize);\r\n        var cipherText = new Buffer(ivAndCiphertext.length - ivSize);\r\n\r\n        ivAndCiphertext.copy(iv, 0, 0, ivSize);\r\n        ivAndCiphertext.copy(cipherText, 0, ivSize);\r\n\r\n        twofishCbc.open('somekey', iv);\r\n\r\n        console.log(twofishCbc.decrypt(cipherText).toString());\r\n```\r\nI am stuck here. Could you please help me how to decrypt using mcrypt library."},"comment":{"url":"https://api.github.com/repos/tugrul/node-mcrypt/issues/comments/155429986","html_url":"https://github.com/tugrul/node-mcrypt/issues/35#issuecomment-155429986","issue_url":"https://api.github.com/repos/tugrul/node-mcrypt/issues/35","id":155429986,"user":{"login":"tugrul","id":163442,"avatar_url":"https://avatars.githubusercontent.com/u/163442?v=3","gravatar_id":"","url":"https://api.github.com/users/tugrul","html_url":"https://github.com/tugrul","followers_url":"https://api.github.com/users/tugrul/followers","following_url":"https://api.github.com/users/tugrul/following{/other_user}","gists_url":"https://api.github.com/users/tugrul/gists{/gist_id}","starred_url":"https://api.github.com/users/tugrul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tugrul/subscriptions","organizations_url":"https://api.github.com/users/tugrul/orgs","repos_url":"https://api.github.com/users/tugrul/repos","events_url":"https://api.github.com/users/tugrul/events{/privacy}","received_events_url":"https://api.github.com/users/tugrul/received_events","type":"User","site_admin":false},"created_at":"2015-11-10T14:07:45Z","updated_at":"2015-11-10T14:07:45Z","body":"I dont know that php framework how could handle iv. Stackoverflow can be helpful than bug report. \r\nThanks"}}