Questions tagged [twofish]

Twofish is a symmetric key block cipher designed by Bruce Schneier and his team of cryptographers for the 1997 Advanced Encryption Standard contest.

Twofish is a symmetric key block cipher with a block size of 128 bits and key sizes up to 256 bits, designed by a team including Bruce Schneier, John Kelsey, Doug Whiting, David Wagner, Chris Hall, and Niels Ferguson, for the 1997 Advanced Encryption Standard contest. It was one of the finalists in the contest, but was not chosen for standardization by the National Institute.

Twofish's distinctive features are the use of pre-computed key-dependent S-boxes, and a relatively complex key schedule. One half of an n-bit key is used as the actual encryption key and the other half of the n-bit key is used to modify the encryption algorithm (key-dependent S-boxes). Twofish borrows some elements from other designs; for example, the pseudo-Hadamard transform (PHT) from the SAFER family of ciphers. Twofish uses the same Feistel structure as DES.

The Twofish cipher has not been patented and the reference implementation has been placed in the public domain.

31 questions
5
votes
3 answers

Twofish encryption in Python

I have a test tool which uses Twofish as the encryption algorithm to encrypt data before sending it to the server. The code is written in C++ and uses Bruce Schneier's optimized C implementation…
anilmwr
  • 477
  • 9
  • 16
4
votes
1 answer

Twofish Key Expansion

I am trying to implement the Twofish cypher step by step as described in the 1998 paper of Bruce Schneider. Nevertheless, I already fail at the key expansion. I tried to copy the details of the paper 1-to-1 into python, with the following result: #!…
Hyperboreus
  • 31,997
  • 9
  • 47
  • 87
3
votes
1 answer

Twofish known answer test

I'm looking into using twofish to encrypt strings of data. Before trusting my precious data to an unknown library I wish to verify that it agrees with the known answer tests published on Bruce Schneier's website. To my dismay I tried three twofish…
Amos Joshua
  • 1,601
  • 18
  • 25
3
votes
1 answer

How to implement twofish encryption to encrypt/decrypt strings in java?

i recently downloaded twofish-java.zip from https://www.schneier.com/academic/twofish/download.html . There is a jar file inside it twofish.jar. Some one explain me how to implement twofish encryption in java to encrypt/decrypt strings in java using…
its_kd
  • 41
  • 6
3
votes
0 answers

Twofish keygenerator not available error

I'm working on Twofish encryption and worked on something like the code below. However, I have been getting the above stated error. Kindly help look into it and advice as necessary. SecureRandom sr= new SecureRandom(cipher_key.getBytes()); …
Moresky
  • 77
  • 4
2
votes
4 answers

Working reference implementation of TwoFish?

The wikipedia page on TwoFish points at this reference implementation in C (and code) which is fine, but it lacks a main and my first few passes at implementing one didn't correctly process any of the "known vector" test cases I attempted. I suspect…
BCS
  • 75,627
  • 68
  • 187
  • 294
1
vote
1 answer

Serpent and Twofish library C

I need to cipher an array of unsigned char (16 byte long) with Serpent and Twofish. I use two libraries -write in c- from the official website. I try to use them, but the ciphertext that i will obtain isn’t correct. For checking I use this site. I…
1
vote
1 answer

GPG - Max Keysize with TWOFISH symmetric encryption

I'm using a script to pack and encrypt archives in order to backup them in cloud storage. It generates shell commands like this: cd /vault/backup/pictures; tar cf - vacation-201309 | xz -3 | gpg --symmetric --cipher-algo TWOFISH --digest-algo SHA512…
royskatt
  • 1,190
  • 2
  • 15
  • 35
1
vote
1 answer

Twofish: whitening subkey generation

I'm implementing the Twofish algorithm for use in educational software. Im using QT for UI and using research from Wikipedia and the Twofish paper of Bruce Schneier, but Im stuck on generating the whitening subkeys. I've successfuly understood how…
Ivan Kolmychek
  • 1,261
  • 1
  • 9
  • 17
0
votes
1 answer

Android Twofish File Encryption Tutorials?

I'm making an app for android to encrypt files. I want to use TwoFish as my algorithm but I don't know how to do encryption. Can someone direct me to a basic tutorial site or better covering how to use the TwoFish?
0
votes
3 answers

Getting java.security.InvalidKeyException: Key must be 128, 192, or 256 bit long twofish

Following code is written to encrypt the plain text, I am using IAIK Twofish encryption/decryption code in java below sample code works fine with 128 bit key but when i try it with 192 and 156 bit key it gives an exception that …
Dheeraj Singh
  • 109
  • 1
  • 16
0
votes
1 answer

Twofish encryption decryption Algorithm

I am using a sample code from a git repository to understand twofish algorithm, The code below works very fine the results are also correct checked from an online tool ref http://twofish.online-domain-tools.com/ the problem is as below :- int[]…
Dheeraj Singh
  • 109
  • 1
  • 16
0
votes
1 answer

Twofish encryption implementation using python

I'm trying to encrypt "Hello world" using Twofish algorithm in python. I use this package https://pypi.python.org/pypi/twofish/0.3.0 There's no problem encrypting the message, however I want to set cipher mode to CBC and I don't know how to do it.…
Chutika
  • 3
  • 1
0
votes
1 answer

How to encrypt with Twofish using ECB cipher mode and PKCS7 block padding mode?

I want to access an API with PHP. The specifications are: Twofish algorithm ECB cipher mode PKCS7 block padding mode I have tried a lot of different PHP functions and libraries, but none seems to work. Here is my code: function encrypt($data,…
malisokan
  • 5,362
  • 2
  • 20
  • 19
0
votes
0 answers

Twofish encryption: "java.security.NosuchAlgorithnException:Twofish KeyGenerator not available" error

This is the code to generate key for twofish algo and to encrypt using it. SecureRandom sr = new SecureRandom(key.getBytes()); KeyGenerator kg = KeyGenerator.getInstance("twofish"); kg.init(sr); SecretKey sk = kg.generateKey(); // create an…
Shilpi
  • 1
  • 1
1
2 3