コード例 #1
0
    //tutaj jest enkrypcja i dekrypcja
    public void EncryptTest()
    {
        TwoFish tf = new TwoFish();

        tf.GenerateKeys(TwoFish.ConvertHexToBitArray("00000000000000000000000000000000"));
        BitArray encrypted = tf.Encrypt(TwoFish.ConvertHexToBitArray("00000000000000000000000000000000"));

        tf.DebugBits(encrypted);
        BitArray decrypted = tf.Decrypt(encrypted);

        tf.DebugBits(decrypted);
    }
コード例 #2
0
    private string text128bit = "000102030405060708090A0B0C0D0E0F"; //"54776F46697368206973206E69636520";

    public string StartTwofish(string asset, bool shouldEncrypt)
    {
        TwoFish  tf    = new TwoFish();
        BitArray bytes = TwoFish.ConvertHexToBitArray(key);

        tf.GenerateKeys(bytes);
        string result = "";

        if (shouldEncrypt)
        {
            result = tf.Encrypt(asset);
        }
        else
        {
            result = tf.Decrypt(asset);
        }
        return(result);
    }