Skip to content

Request Twofish #1

Description

@GoogleCodeExporter
Hi,

do you integrate Twofish?

http://ats.oka.nu/titaniumcore/js/crypto/Cipher.sample.html

This sample works for me with mcrypt. 

Here my PHP Code:

**************

<?php

/**
 * @author Josef Fröhle
 * @copyright 2012
 */

    $iv_size = mcrypt_get_iv_size(MCRYPT_TWOFISH, MCRYPT_MODE_CBC);
    $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
    $key = base64_decode('IDJkKkhBcyxWKDdWMzpgcjU3Vj4sWylsSStORkclfWM=');
    $text = "Meet me at 11 o'clock behind the monument.";
    echo base64_encode($key) . "\r\n";

    $crypttext = mcrypt_encrypt(MCRYPT_TWOFISH, $key, $text, MCRYPT_MODE_CBC, $iv);
    echo base64_encode($iv.$crypttext) . "\r\n";

    $text = "reSz4nYwvUn2bCivKpNxRcausJ71JQHsGvoIKUc2Nvdl+nUw
OtHPPV2sqU7TyS+tg1eBeuxVzf6nvbn3J9yWlA==";
    $text_enc = base64_decode($text);
    $iv = substr($text_enc,0,16);
    echo strlen($iv) . "\r\n";
    $text = substr($text_enc,16);
    $crypttext = mcrypt_decrypt(MCRYPT_TWOFISH, $key, $text, MCRYPT_MODE_CBC, $iv);
    echo $crypttext;
?>

Original issue reported on code.google.com by josef.fr...@googlemail.com on 12 Dec 2012 at 8:57

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions