100+ results for 'crypto.cip blowfish'
Not the results you expected?
DESCoder.java (https://bitbucket.org/beginnerjyh/es.git) Java · 132 lines
3 import javax.crypto.Cipher;
4 import javax.crypto.SecretKey;
12 * <pre>
13 * 支持 DES、DESede(TripleDES,就是3DES)、AES、Blowfish、RC2、RC4(ARCFOUR)
14 * DES key size must be equal to 56
16 * AES key size must be equal to 128, 192 or 256,but 192 and 256 bits may not be available
17 * Blowfish key size must be multiple of 8, and can only range from 32 to 448 (inclusive)
18 * RC2 key size must be between 40 and 1024 bits
34 * AES key size must be equal to 128, 192 or 256,but 192 and 256 bits may not be available
35 * Blowfish key size must be multiple of 8, and can only range from 32 to 448 (inclusive)
36 * RC2 key size must be between 40 and 1024 bits
StringEncrypter.java (https://gitlab.com/essere.lab.public/qualitas.class-corpus) Java · 312 lines
7 // CIPHER / GENERATORS
8 import javax.crypto.Cipher;
9 import javax.crypto.SecretKey;
224 SecretKey desKey = KeyGenerator.getInstance( "DES" ).generateKey();
225 SecretKey blowfishKey = KeyGenerator.getInstance( "Blowfish" ).generateKey();
226 SecretKey desedeKey = KeyGenerator.getInstance( "DESede" ).generateKey();
229 StringEncrypter desEncrypter = new StringEncrypter( desKey, desKey.getAlgorithm() );
230 StringEncrypter blowfishEncrypter = new StringEncrypter( blowfishKey, blowfishKey.getAlgorithm() );
231 StringEncrypter desedeEncrypter = new StringEncrypter( desedeKey, desedeKey.getAlgorithm() );
234 String desEncrypted = desEncrypter.encrypt( secretString );
235 String blowfishEncrypted = blowfishEncrypter.encrypt( secretString );
236 String desedeEncrypted = desedeEncrypter.encrypt( secretString );
239 String desDecrypted = desEncrypter.decrypt( desEncrypted );
240 String blowfishDecrypted = blowfishEncrypter.decrypt( blowfishEncrypted );
241 String desedeDecrypted = desedeEncrypter.decrypt( desedeEncrypted );
Blowfish.py (https://gitlab.com/grayhamster/pycrypto) Python · 132 lines
2 #
3 # Cipher/Blowfish.py : Blowfish
4 #
34 >>> from Crypto.Cipher import Blowfish
35 >>> from Crypto import Random
40 >>> iv = Random.new().read(bs)
41 >>> cipher = Blowfish.new(key, Blowfish.MODE_CBC, iv)
42 >>> plaintext = b'docendo discimus '
48 .. _Blowfish: http://www.schneier.com/blowfish.html
55 from Crypto.Cipher import blockalgo
56 from Crypto.Cipher import _Blowfish
StringOBF.java (https://gitlab.com/N00bVip/Noxious) Java · 88 lines
8 import javax.crypto.Cipher;
9 import javax.crypto.spec.SecretKeySpec;
16 SecretKeySpec sksSpec =
17 new SecretKeySpec(key.getBytes(), "Blowfish");
19 Cipher cipher = Cipher.getInstance("Blowfish");
20 cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, sksSpec);
51 SecretKeySpec sksSpec =
52 new SecretKeySpec(key.getBytes(), "Blowfish");
54 Cipher cipher = Cipher.getInstance("Blowfish");
55 cipher.init(Cipher.DECRYPT_MODE, sksSpec);
encrypted.py (https://bitbucket.org/vitormazzi/skink.git) Python · 106 lines
6 encrypted and safely encoded for storage in a unicode column using the powerful
7 and secure Blowfish Cipher using a specified "secret" which can be passed into
8 the plugin at class declaration time.
29 from Crypto.Cipher import Blowfish
30 from elixir.statements import Statement
41 def encrypt_value(value, secret):
42 return Blowfish.new(secret, Blowfish.MODE_CFB) \
43 .encrypt(value).encode('string_escape')
45 def decrypt_value(value, secret):
46 return Blowfish.new(secret, Blowfish.MODE_CFB) \
47 .decrypt(value.decode('string_escape'))
CipherWithWrappingSpi.java (https://github.com/ikeji/openjdk7-jdk.git) Java · 261 lines
BlowfishCBC.java (https://github.com/xv1t/SquidModel.GUI.git) Java · 70 lines
35 public class BlowfishCBC implements Cipher{
36 private static final int ivsize=8;
37 private static final int bsize=16;
38 private javax.crypto.Cipher cipher;
39 public int getIVSize(){return ivsize;}
56 SecretKeySpec skeySpec = new SecretKeySpec(key, "Blowfish");
57 cipher=javax.crypto.Cipher.getInstance("Blowfish/CBC/"+pad);
58 cipher.init((mode==ENCRYPT_MODE?
59 javax.crypto.Cipher.ENCRYPT_MODE:
60 javax.crypto.Cipher.DECRYPT_MODE),
gnu.javax.crypto.cipher.java (https://github.com/facebook/pfff.git) Java · 400 lines
TestLadderEncoding.java (https://github.com/ickik/TestLadder.git) Java · 131 lines
8 import javax.crypto.BadPaddingException;
9 import javax.crypto.Cipher;
10 import javax.crypto.IllegalBlockSizeException;
25 private static final String ALGORITHM = "Blowfish";
26 private static final String TRANSFORMATION = "Blowfish/CBC/PKCS5Padding";
34 * stored in local.
35 * <br>The algorithm chooses is blowfish.
36 * @param login the login of the user used as key.
37 * @param password the password associates to the login.
38 * @return the password encrypted with blowfish algorithm.
39 * @throws LadderException this exception is thrown when an error occurs
69 * stored in local.
70 * <br>The algorithm chooses is blowfish.
71 * @param login the login of the user used as key.
BlockCipherFactory.java (https://gitlab.com/imxieke/remote-desktop-clients) Java · 115 lines
2 package com.trilead.ssh2.crypto.cipher;
36 ciphers.addElement(new CipherEntry("aes256-ctr", 16, 32, "com.trilead.ssh2.crypto.cipher.AES"));
37 ciphers.addElement(new CipherEntry("aes192-ctr", 16, 24, "com.trilead.ssh2.crypto.cipher.AES"));
38 ciphers.addElement(new CipherEntry("aes128-ctr", 16, 16, "com.trilead.ssh2.crypto.cipher.AES"));
39 ciphers.addElement(new CipherEntry("blowfish-ctr", 8, 16, "com.trilead.ssh2.crypto.cipher.BlowFish"));
41 ciphers.addElement(new CipherEntry("aes256-cbc", 16, 32, "com.trilead.ssh2.crypto.cipher.AES"));
42 ciphers.addElement(new CipherEntry("aes192-cbc", 16, 24, "com.trilead.ssh2.crypto.cipher.AES"));
43 ciphers.addElement(new CipherEntry("aes128-cbc", 16, 16, "com.trilead.ssh2.crypto.cipher.AES"));
44 ciphers.addElement(new CipherEntry("blowfish-cbc", 8, 16, "com.trilead.ssh2.crypto.cipher.BlowFish"));
Blowfish.java (https://gitlab.com/rizon/acid.git) Java · 294 lines
3 /**
4 * Blowfish.java version 1.00.00
5 *
32 import java.security.InvalidKeyException;
33 import javax.crypto.Cipher;
34 import javax.crypto.spec.SecretKeySpec;
38 public class Blowfish
39 {
40 private static final Logger log = LoggerFactory.getLogger(Blowfish.class);
42 /*
43 * Constructor of Blowfish class Key param
44 */
cryptocipher.py (https://github.com/dahool/vertaal.git) Python · 69 lines
20 import base64
21 from Crypto.Cipher import Blowfish
22 from django.conf import settings
27 pwd = getattr(settings, 'SECRET_KEY')
28 self.__cipher = Blowfish.new(pwd)
29 def encrypt(self, text):
39 return cleartext
40 # Blowfish cipher needs 8 byte blocks to work with
41 def __pad_file(self, text):
crypto.py (https://code.google.com/p/wallproxy-plugins/) Python · 130 lines
34 _BlockSize = {'AES':16, 'ARC2':8, 'ARC4':1, 'Blowfish':8, 'CAST':8,
35 'DES':8, 'DES3':8, 'IDEA':8, 'RC5':8, 'XOR':1}
63 if self.cipher=='RC5' and self.keysize in (1, 57): self.keysize=32
64 #try to import Crypto.Cipher.xxxx
65 try:
66 cipherlib = __import__('Crypto.Cipher.'+self.cipher, fromlist='x')
67 self._newobj = cipherlib.new
models.py (https://github.com/goodguy/satchmo.git) Python · 127 lines
6 from Crypto.Cipher import Blowfish
7 from datetime import datetime
111 """Decrypt code encrypted by _encrypt_code"""
112 # In some blowfish implementations, > 56 char keys can cause problems
113 secret_key = settings.SECRET_KEY[:56]
114 encryption_object = Blowfish.new(secret_key)
115 # strip padding from decrypted credit card number
119 """Quick encrypter for CC codes or code fragments"""
120 # In some blowfish implementations, > 56 char keys can cause problems
121 secret_key = settings.SECRET_KEY[:56]
122 encryption_object = Blowfish.new(secret_key)
123 # block cipher length must be a multiple of 8
Turkish.java (https://github.com/shchiu/openjdk.git) Java · 49 lines
__init__.py (https://github.com/volpino/Yeps-EURAC.git) Python · 58 lines
util.py (https://bitbucket.org/nicste/ballaxy.git) Python · 32 lines
2 pkg_resources.require( "pycrypto" )
3 from Crypto.Cipher import Blowfish
14 user_hash = ( "!" * ( 8 - len( user_hash ) % 8 ) ) + user_hash
15 cipher = Blowfish.new( str( dataset.create_time ) )
16 user_hash = cipher.encrypt( user_hash ).encode( 'hex' )
27 else:
28 cipher = Blowfish.new( str( dataset.create_time ) )
29 user_id = cipher.decrypt( user_hash.decode( 'hex' ) ).lstrip( "!" )
Cipher.hs (git://github.com/vincenthz/hs-cryptocipher.git) Haskell · 57 lines
1 -- |
2 -- Module : Crypto.Cipher
3 -- License : BSD-style
12 --
13 -- > import Crypto.Cipher
14 -- > import Data.ByteString (ByteString)
23 --
24 module Crypto.Cipher
25 (
45 , AES128, AES192, AES256
46 , Blowfish, Blowfish64, Blowfish128, Blowfish256, Blowfish448
47 , DES
53 import Crypto.Cipher.AES (AES128, AES192, AES256)
54 import Crypto.Cipher.Blowfish
55 import Crypto.Cipher.DES
CipherFactory.java (https://github.com/clibrepo/04f6ea02286af71632b72d73554979a61da424cf681886674b21ecd595715c12.git) Java · 150 lines
BlowfishSerializer.java (https://gitlab.com/kidaa/kryo.git) Java · 82 lines
24 import javax.crypto.Cipher;
25 import javax.crypto.CipherInputStream;
26 import javax.crypto.CipherOutputStream;
27 import javax.crypto.spec.SecretKeySpec;
35 /** Encrypts data using the blowfish cipher.
36 * @author Nathan Sweet <misc@n4te.com> */
37 public class BlowfishSerializer extends Serializer {
38 private final Serializer serializer;
41 public BlowfishSerializer (Serializer serializer, byte[] key) {
42 this.serializer = serializer;
KeyGen.java (http://aionxemu.googlecode.com/svn/trunk/) Java · 97 lines
23 import javax.crypto.Cipher;
24 import javax.crypto.KeyGenerator;
30 /**
31 * Key generator. It generates keys or keyPairs for Blowfish and RSA
32 *
41 /**
42 * Key generator for blowfish
43 */
44 private static KeyGenerator blowfishKeyGen;
59 blowfishKeyGen = KeyGenerator.getInstance("Blowfish");
__init__.py
(https://bitbucket.org/chapmanb/galaxy-central/)
Python · 76 lines
✨ Summary
This Python code provides a SecurityHelper
class that handles encryption and decryption of IDs using Blowfish cipher. It generates random bytes for high entropy values, encodes IDs as hexadecimal strings, and decodes them back to integers. The class also includes functions to encode GUIDs (Globally Unique Identifiers) and generate new GUIDs.
This Python code provides a SecurityHelper
class that handles encryption and decryption of IDs using Blowfish cipher. It generates random bytes for high entropy values, encodes IDs as hexadecimal strings, and decodes them back to integers. The class also includes functions to encode GUIDs (Globally Unique Identifiers) and generate new GUIDs.
JCEKeyGenerator.java (https://github.com/MIPS/external-bouncycastle.git) Java · 538 lines
__init__.py (https://gitlab.com/grayhamster/pycrypto) Python · 83 lines
41 ======================== ======= ========================
42 `Crypto.Cipher.AES` Block Advanced Encryption Standard
43 `Crypto.Cipher.ARC2` Block Alleged RC2
44 `Crypto.Cipher.ARC4` Stream Alleged RC4
45 `Crypto.Cipher.Blowfish` Block Blowfish
46 `Crypto.Cipher.CAST` Block CAST
47 `Crypto.Cipher.DES` Block The Data Encryption Standard.
48 Very commonly used in the past,
49 but today its 56-bit keys are too small.
50 `Crypto.Cipher.DES3` Block Triple DES.
51 `Crypto.Cipher.XOR` Stream The simple XOR cipher.
66 ========================== =======================
67 `Crypto.Cipher.PKCS1_v1_5` PKCS#1 v1.5 encryption, based on RSA key pairs
68 `Crypto.Cipher.PKCS1_OAEP` PKCS#1 OAEP encryption, based on RSA key pairs
Tests.hs (git://github.com/vincenthz/hs-cryptocipher.git) Haskell · 51 lines
4 import Test.Framework (defaultMain, testGroup)
5 import Crypto.Cipher.Blowfish
6 import Crypto.Cipher.Types
7 import Crypto.Cipher.Tests
8 import Data.ByteString.Char8 () -- orphan IsString for older bytestring versions
49 main = defaultMain
50 [ testBlockCipher kats (undefined :: Blowfish64)
51 ]
SecretKeyEncryptionStrategy.java (https://gitlab.com/thugside/mule) Java · 124 lines
17 import javax.crypto.Cipher;
18 import javax.crypto.KeyGenerator;
25 * A keyFactory is an implementation of {@link SecretKeyFactory} and must return a
26 * byte array. The default algorthm used by this strategy is Blowfish, but users can
27 * specify any valid algorithm supported by JCE.
38 public static final String DEFAULT_ALGORITHM = "Blowfish";
GnuCrypto.java (https://github.com/penberg/classpath.git) Java · 598 lines
41 import gnu.java.security.Registry;
42 import gnu.javax.crypto.cipher.CipherFactory;
43 import gnu.javax.crypto.mac.MacFactory;
74 put("Cipher.ARCFOUR ImplementedIn", "Software");
75 put("Cipher.BLOWFISH",
76 gnu.javax.crypto.jce.cipher.BlowfishSpi.class.getName());
77 put("Cipher.BLOWFISH ImplementedIn", "Software");
78 put("Cipher.DES", gnu.javax.crypto.jce.cipher.DESSpi.class.getName());
112 gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Anubis.class.getName());
113 put("Cipher.PBEWithHMacHavalAndBlowfish",
114 gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Blowfish.class.getName());
133 gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Anubis.class.getName());
134 put("Cipher.PBEWithHMacMD2AndBlowfish",
135 gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Blowfish.class.getName());
PEMUtilities.java (https://gitlab.com/essere.lab.public/qualitas.class-corpus) Java · 185 lines
__init__.py (https://github.com/dahool/vertaal.git) Python · 120 lines
35 Cipher.__init__(self, key)
36 self.__cipher = Blowfish(key)
61 # Blowfish cipher needs 8 byte blocks to work with
62 def __pad_text(self, text):
81 Cipher.__init__(self, key)
82 self.__cipher = Blowfish.new(key)
115 try:
116 from Crypto.Cipher import Blowfish
117 cipher = CryptoCipher
118 except:
119 from blowfishcipher.blowfish import Blowfish
120 cipher = LocalCipher
__init__.py (https://github.com/ambv/kitpy.git) Python · 59 lines
36 from Crypto.Cipher import AES as _AES
37 from Crypto.Cipher import Blowfish as _Blowfish
38 from Crypto.Cipher import CAST as _CAST
39 from Crypto.Cipher import DES as _DES
40 from Crypto.Cipher import DES3 as _DES3
47 part.__name__ = name.lower()
48 part.__module__ = b'lck.crypto.cipher'
49 part.__doc__ = ("{}([key, path, create]) -> Cipher instance\n\nFactory "
55 aes = _setup_cipher(_AES)
56 blowfish = _setup_cipher(_Blowfish)
57 cast = _setup_cipher(_CAST)
Blowfish.java (https://gitlab.com/essere.lab.public/qualitas.class-corpus) Java · 107 lines
28 import javax.crypto.BadPaddingException;
29 import javax.crypto.Cipher;
30 import javax.crypto.IllegalBlockSizeException;
36 public class Blowfish {
37 private static final Logger LOG = Logger
38 .getLogger("org.columba.util.blowfish");
43 private static final Key KEY = new SecretKeySpec(BYTES, "Blowfish");
47 // Create the cipher
48 Cipher blowCipher = Cipher.getInstance("Blowfish");
models.py (https://github.com/Ryati/satchmo.git) Python · 124 lines
6 from Crypto.Cipher import Blowfish
7 from datetime import datetime
111 secret_key = settings.SECRET_KEY
112 encryption_object = Blowfish.new(secret_key)
113 # strip padding from decrypted credit card number
118 secret_key = settings.SECRET_KEY
119 encryption_object = Blowfish.new(secret_key)
120 # block cipher length must be a multiple of 8
DiffieHellman.scala (https://github.com/xrayn/tpm-scala.git) Scala · 160 lines
7 import scala.util.Random
8 import javax.crypto.Cipher
9 import javax.crypto.KeyGenerator
30 def encryptBlowfish(aesKey: String, peerPubKey: Option[String]): Option[String] = {
37 val sharedKey = getSharedKey().toString().getBytes()
38 val myKeySpec = new SecretKeySpec(sharedKey, "Blowfish");
39 val cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
51 def decryptBlowfish(aesKey: String, peerPubKey: Option[String]): Option[String] = {
60 val sharedKey = getSharedKey().toString().getBytes()
61 val myKeySpec = new SecretKeySpec(sharedKey, "Blowfish");
62 val cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
BlockCipherFactory.java (https://github.com/8nevil8/ganymed-ssh-2.git) Java · 130 lines
4 */
5 package ch.ethz.ssh2.crypto.cipher;
39 /* Higher Priority First */
40 ciphers.add(new CipherEntry("aes128-ctr", 16, 16, "ch.ethz.ssh2.crypto.cipher.AES"));
41 ciphers.add(new CipherEntry("aes192-ctr", 16, 24, "ch.ethz.ssh2.crypto.cipher.AES"));
42 ciphers.add(new CipherEntry("aes256-ctr", 16, 32, "ch.ethz.ssh2.crypto.cipher.AES"));
43 ciphers.add(new CipherEntry("blowfish-ctr", 8, 16, "ch.ethz.ssh2.crypto.cipher.BlowFish"));
45 ciphers.add(new CipherEntry("aes128-cbc", 16, 16, "ch.ethz.ssh2.crypto.cipher.AES"));
46 ciphers.add(new CipherEntry("aes192-cbc", 16, 24, "ch.ethz.ssh2.crypto.cipher.AES"));
47 ciphers.add(new CipherEntry("aes256-cbc", 16, 32, "ch.ethz.ssh2.crypto.cipher.AES"));
48 ciphers.add(new CipherEntry("blowfish-cbc", 8, 16, "ch.ethz.ssh2.crypto.cipher.BlowFish"));
config.py (https://github.com/ahri/financials.git) Python · 47 lines
__init__.py (https://bitbucket.org/galaxy/galaxy-central/) Python · 131 lines
models.py (https://github.com/davemerwin/satchmo.git) Python · 82 lines
6 from Crypto.Cipher import Blowfish
7 from django.conf import settings
59 secret_key = settings.SECRET_KEY
60 encryption_object = Blowfish.new(secret_key)
61 # block cipher length must be a multiple of 8
69 secret_key = settings.SECRET_KEY
70 encryption_object = Blowfish.new(secret_key)
71 # strip padding from decrypted credit card number
Cryption.java (https://github.com/aharisu/SyncBookmark.git) Java · 68 lines
6 import javax.crypto.BadPaddingException;
7 import javax.crypto.Cipher;
8 import javax.crypto.IllegalBlockSizeException;
17 public class Cryption {
18 private static final String TRANSFORMATION = "Blowfish";
27 Cipher cipher = Cipher.getInstance(TRANSFORMATION);
28 cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, spec);
29 return cipher.doFinal(text.getBytes());
50 Cipher cipher = Cipher.getInstance(TRANSFORMATION);
51 cipher.init(javax.crypto.Cipher.DECRYPT_MODE, spec);
52 return new String(cipher.doFinal(encrypted));
SilverCryptFactorySymetric.java (https://github.com/NicolasEYSSERIC/Silverpeas-Core.git) Java · 138 lines
misc.py (https://github.com/tsaylor/BARcamp-Chicago-Website.git) Python · 43 lines
6 from Crypto.Cipher import Blowfish
7 from base64 import *
12 def cryptString( secret, plain ):
13 obj = Blowfish.new( secret, Blowfish.MODE_ECB )
14 #randstring = unicode(open("/dev/urandom").read(12), 'ascii', 'ignore')
30 def decryptString( secret, cipher ):
31 obj = Blowfish.new( secret, Blowfish.MODE_ECB )
32 try:
SecretUtils.java (https://gitlab.com/JingYing/paipaiapp) Java · 152 lines
CodecAndCryptoTest.java (https://gitlab.com/0072016/0072016-show) Java · 203 lines
13 import javax.crypto.Cipher;
14 import java.security.*;
161 public void testBlowfishCipherService() {
162 BlowfishCipherService blowfishCipherService = new BlowfishCipherService();
163 blowfishCipherService.setKeySize(128);
165 //生成key
166 Key key = blowfishCipherService.generateNewKey();
170 //加密
171 String encrptText = blowfishCipherService.encrypt(text.getBytes(), key.getEncoded()).toHex();
172 //解密
173 String text2 = new String(blowfishCipherService.decrypt(Hex.decode(encrptText), key.getEncoded()).getBytes());
BlowfishJC.java (https://github.com/aldago/DQLScriptExecutor.git) Java · 180 lines
CipherFactory.java (https://github.com/penberg/classpath.git) Java · 129 lines
ERXAbstractBlowfishCrypter.java (https://github.com/dbaillon/wonder.git) Java · 226 lines
14 /**
15 * ERXAbstractBlowfishCrypter is a blowfish implementation of the crypter
16 * interface that allows subclasses to override the source of the blowfish key.
17 * The blowfish cipher is a two-way cipher meaning the original string that was
18 * encrypted can be retrieved. The way that this version of the blowfish cipher
19 * is encrypted it is safe to use as a form value.
75 try {
76 Cipher cipher = Cipher.getInstance("Blowfish/ECB/NoPadding");
77 cipher.init(mode, secretBlowfishKey());
101 /**
102 * Method used to return the shared instance of the blowfish decryption
103 * cipher.
179 * Blowfish encodes a given string using the secret key specified in the
180 * System property: <b>ERBlowfishCipherKey</b>. The blowfish cipher is a
181 * two way cipher meaning that given the secret key you can de-cipher what
SIDCrypto.py (https://gitlab.com/bcolin/sid) Python · 193 lines
__init__.py (https://github.com/dbcls/dbcls-galaxy.git) Python · 60 lines
Eryptogram.java (http://liweistudy.googlecode.com/svn/trunk/) Java · 145 lines
StringEncrypter.java (https://github.com/bowler-framework/recursivity-commons.git) Java · 240 lines
4 // CIPHER / GENERATORS
5 import javax.crypto.Cipher;
6 import javax.crypto.SecretKey;
195 SecretKey desKey = KeyGenerator.getInstance("DES").generateKey();
196 SecretKey blowfishKey = KeyGenerator.getInstance("Blowfish").generateKey();
197 SecretKey desedeKey = KeyGenerator.getInstance("DESede").generateKey();
200 StringEncrypter desEncrypter = new StringEncrypter(desKey, desKey.getAlgorithm());
201 StringEncrypter blowfishEncrypter = new StringEncrypter(blowfishKey, blowfishKey.getAlgorithm());
202 StringEncrypter desedeEncrypter = new StringEncrypter(desedeKey, desedeKey.getAlgorithm());
205 String desEncrypted = desEncrypter.encrypt(secretString);
206 String blowfishEncrypted = blowfishEncrypter.encrypt(secretString);
207 String desedeEncrypted = desedeEncrypter.encrypt(secretString);
210 String desDecrypted = desEncrypter.decrypt(desEncrypted);
211 String blowfishDecrypted = blowfishEncrypter.decrypt(blowfishEncrypted);
212 String desedeDecrypted = desedeEncrypter.decrypt(desedeEncrypted);
AbstractBlowfishCipher.java (https://gitlab.com/rwf/blowfish-hasher) Java · 51 lines
1 package org.filho.util.blowfish.cipher;
6 import javax.crypto.Cipher;
7 import javax.crypto.NoSuchPaddingException;
10 import org.filho.util.blowfish.hasher.Mode;
12 /**
13 * Contains all the methods to manipulate the blowfish hashes.
14 * @author Roberto Filho
16 */
17 public abstract class AbstractBlowfishCipher {
19 public Cipher getCipher(Mode mode, SecretKeySpec keySpec) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException {
20 // Use blowfish with ECB and PKCS5 padding
21 Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
models.py (https://github.com/roadhead/satchmo.git) Python · 106 lines
6 from Crypto.Cipher import Blowfish
7 from datetime import datetime
66 secret_key = settings.SECRET_KEY
67 encryption_object = Blowfish.new(secret_key)
68 # block cipher length must be a multiple of 8
93 secret_key = settings.SECRET_KEY
94 encryption_object = Blowfish.new(secret_key)
95 # strip padding from decrypted credit card number
BlowfishCbc.java (http://ece01sd.googlecode.com/svn/trunk/) Java · 129 lines
37 import javax.crypto.Cipher;
38 import javax.crypto.NoSuchPaddingException;
48 */
49 public class BlowfishCbc extends SshCipher {
50 private static Log log = LogFactory.getLog(BlowfishCbc.class);
52 /** */
53 protected static String algorithmName = "blowfish-cbc";
54 Cipher cipher;
56 /**
57 * Creates a new BlowfishCbc object.
58 */
59 public BlowfishCbc() {
60 }
BlowfishKey.java (https://github.com/muness/blowfish_encryption_example.git) Java · 74 lines
1 import javax.crypto.Cipher;
2 import java.security.Key;
18 public class BlowfishKey {
34 public static byte[] encrypt(String plainText) throws Exception {
35 Cipher cipher = Cipher.getInstance("Blowfish");
36 cipher.init(Cipher.ENCRYPT_MODE, getKeySpec());
48 public static String decrypt(byte[] cipherText) throws Exception {
49 Cipher cipher = Cipher.getInstance("Blowfish");
50 cipher.init(Cipher.DECRYPT_MODE, getKeySpec());
58 byte[] raw = getKey();
59 return (new SecretKeySpec(raw, "Blowfish"));
60 }
encrypted.py (https://github.com/jespino/niwi-web.git) Python · 58 lines
fileconfigmanager.py (https://github.com/donaldharvey/snappy.git) Python · 135 lines
4 import os
5 from Crypto.Cipher import Blowfish #for password storage
6 from hashlib import sha1
52 cryptkey = sha1(key).hexdigest()
53 bf = Blowfish.new(cryptkey, Blowfish.MODE_ECB)
54 encrypted_pass = bf.encrypt(self._pad_pass(password))
59 cryptkey = sha1(key).hexdigest()
60 bf = Blowfish.new(cryptkey, Blowfish.MODE_ECB)
61 try:
models.py (https://github.com/CulturePlex/Sylva.git) Python · 161 lines
BlockCipherResetTest.java (https://gitlab.com/edgardo001/bc-java) Java · 206 lines
3 import org.bouncycastle.crypto.BlockCipher;
4 import org.bouncycastle.crypto.CipherParameters;
5 import org.bouncycastle.crypto.DataLengthException;
9 import org.bouncycastle.crypto.engines.AESLightEngine;
10 import org.bouncycastle.crypto.engines.BlowfishEngine;
11 import org.bouncycastle.crypto.engines.CAST5Engine;
62 testReset("DESEngine", new DESEngine(), new DESEngine(), new KeyParameter(new byte[8]));
63 testReset("BlowfishEngine", new BlowfishEngine(), new BlowfishEngine(), new KeyParameter(new byte[8]));
64 testReset("CAST5Engine", new CAST5Engine(), new CAST5Engine(), new KeyParameter(new byte[8]));
common.py (https://bitbucket.org/chapmanb/galaxy-central/) Python · 167 lines
__init__.py (https://github.com/wizzk42/pycrypto.git) Python · 82 lines
41 ====================== ====================
42 Crypto.Cipher.AES Advanced Encryption Standard
43 Crypto.Cipher.ARC2 Alleged RC2
44 Crypto.Cipher.ARC4 Alleged RC4
45 Crypto.Cipher.Blowfish Blowfish
46 Crypto.Cipher.CAST CAST
47 Crypto.Cipher.DES The Data Encryption Standard.
48 Very commonly used in the past,
49 but today its 56-bit keys are too small.
50 Crypto.Cipher.DES3 Triple DES.
51 Crypto.Cipher.XOR The simple XOR cipher.
66 ======================== =======================
67 Crypto.Cipher.PKCS1_v1.5 PKCS#1 v1.5 encryption, based on RSA key pairs
68 Crypto.Cipher.PKCS1_OAEP PKCS#1 OAEP encryption, based on RSA key pairs
KeyGen.java (https://github.com/osiris087/aionj.git) Java · 86 lines
Blowfish.java (https://gitlab.com/edgardo001/bc-java) Java · 88 lines
25 {
26 super(new BlowfishEngine());
27 }
61 {
62 return "Blowfish IV";
63 }
68 {
69 private static final String PREFIX = Blowfish.class.getName();
81 provider.addAlgorithm("KeyGenerator.BLOWFISH", PREFIX + "$KeyGen");
82 provider.addAlgorithm("Alg.Alias.KeyGenerator", MiscObjectIdentifiers.cryptlib_algorithm_blowfish_CBC, "BLOWFISH");
83 provider.addAlgorithm("AlgorithmParameters.BLOWFISH", PREFIX + "$AlgParams");
84 provider.addAlgorithm("Alg.Alias.AlgorithmParameters", MiscObjectIdentifiers.cryptlib_algorithm_blowfish_CBC, "BLOWFISH");
BlockCipherFactory.java (https://github.com/northern-bites/ganymed-ssh2.git) Java · 115 lines
2 package ch.ethz.ssh2.crypto.cipher;
36 ciphers.addElement(new CipherEntry("aes256-ctr", 16, 32, "ch.ethz.ssh2.crypto.cipher.AES"));
37 ciphers.addElement(new CipherEntry("aes192-ctr", 16, 24, "ch.ethz.ssh2.crypto.cipher.AES"));
38 ciphers.addElement(new CipherEntry("aes128-ctr", 16, 16, "ch.ethz.ssh2.crypto.cipher.AES"));
39 ciphers.addElement(new CipherEntry("blowfish-ctr", 8, 16, "ch.ethz.ssh2.crypto.cipher.BlowFish"));
41 ciphers.addElement(new CipherEntry("aes256-cbc", 16, 32, "ch.ethz.ssh2.crypto.cipher.AES"));
42 ciphers.addElement(new CipherEntry("aes192-cbc", 16, 24, "ch.ethz.ssh2.crypto.cipher.AES"));
43 ciphers.addElement(new CipherEntry("aes128-cbc", 16, 16, "ch.ethz.ssh2.crypto.cipher.AES"));
44 ciphers.addElement(new CipherEntry("blowfish-cbc", 8, 16, "ch.ethz.ssh2.crypto.cipher.BlowFish"));
BlowfishCBC.java (https://github.com/ePaul/jsch-documentation.git) Java · 73 lines
35 public class BlowfishCBC implements Cipher{
36 private static final int ivsize=8;
37 private static final int bsize=16;
38 private javax.crypto.Cipher cipher;
39 public int getIVSize(){return ivsize;}
56 SecretKeySpec skeySpec = new SecretKeySpec(key, "Blowfish");
57 cipher=javax.crypto.Cipher.getInstance("Blowfish/CBC/"+pad);
58 synchronized(javax.crypto.Cipher.class){
59 cipher.init((mode==ENCRYPT_MODE?
60 javax.crypto.Cipher.ENCRYPT_MODE:
61 javax.crypto.Cipher.DECRYPT_MODE),
BlowFishKey.java (https://github.com/ichiro101/l2adena-l2j-core.git) Java · 74 lines
21 import javax.crypto.Cipher;
33 */
34 public class BlowFishKey extends BaseRecievePacket
35 {
36 protected static final Logger _log = Logger.getLogger(BlowFishKey.class.getName());
37 /**
39 */
40 public BlowFishKey(byte[] decrypt, GameServerThread server)
41 {
62 server.SetBlowFish(new NewCrypt(key));
63 if (Config.DEBUG)
README.md (git://github.com/vincenthz/hs-cryptocipher.git) Markdown · 76 lines
11 import Crypto.Cipher.Types
12 import Crypto.Cipher
24 And another using CBC mode with Blowfish cipher:
26 import Crypto.Cipher.Types
27 import Crypto.Cipher
29 initBlowfish :: ByteString -> Blowfish
30 initBlowfish = either (error . show) cipherInit . makeKey
32 cryptKey key iv msg = encryptCBC ctx (makeIV iv) msg
33 where ctx = initBlowfish key
Blowfish.hs (git://github.com/vincenthz/hs-cryptocipher.git) Haskell · 61 lines
27 -- | 128 bit keyed blowfish state
28 newtype Blowfish128 = Blowfish128 Context
30 -- | 256 bit keyed blowfish state
31 newtype Blowfish256 = Blowfish256 Context
38 cipherKeySize _ = KeySizeRange 6 56
39 cipherInit k = either error Blowfish $ initBlowfish (toBytes k)
58 INSTANCE_CIPHER(Blowfish64, "blowfish64", 8)
59 INSTANCE_CIPHER(Blowfish128, "blowfish128", 16)
60 INSTANCE_CIPHER(Blowfish256, "blowfish256", 32)
61 INSTANCE_CIPHER(Blowfish448, "blowfish448", 56)
BlowFishCrypt.java (https://github.com/thanhvc/ofbiz.git) Java · 172 lines
36 */
37 public class BlowFishCrypt {
41 /**
42 * Creates a new BlowFishCrypt object.
43 * @param secretKeySpec A SecretKeySpec object.
44 */
45 public BlowFishCrypt(SecretKeySpec secretKeySpec) {
46 this.secretKeySpec = secretKeySpec;
52 */
53 public BlowFishCrypt(byte[] key) {
54 try {
143 String testString = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstufwxyz";
144 BlowFishCrypt c = new BlowFishCrypt(key);
145 byte[] encryptedBytes = c.encrypt(testString);
encrypted.py (git://github.com/RuudBurger/CouchPotatoServer.git) Python · 125 lines
6 encrypted and safely encoded for storage in a unicode column using the powerful
7 and secure Blowfish Cipher using a specified "secret" which can be passed into
8 the plugin at class declaration time.
35 from Crypto.Cipher import Blowfish
36 from elixir.statements import Statement
53 def encrypt_value(value, secret):
54 return Blowfish.new(secret, Blowfish.MODE_CFB) \
55 .encrypt(value).encode('string_escape')
57 def decrypt_value(value, secret):
58 return Blowfish.new(secret, Blowfish.MODE_CFB) \
59 .decrypt(value.decode('string_escape'))
BlowFishKey.java (https://github.com/ichiro101/l2adena-l2j-core.git) Java · 65 lines
23 import javax.crypto.Cipher;
30 */
31 public class BlowFishKey extends BaseSendablePacket
32 {
33 private static Logger _log = Logger.getLogger(BlowFishKey.class.getName());
34 /**
35 * @param blowfishKey
36 * @param publicKey
37 */
38 public BlowFishKey(byte[] blowfishKey, RSAPublicKey publicKey)
39 {
DESCoder.java (http://liweistudy.googlecode.com/svn/trunk/) Java · 139 lines
6 import javax.crypto.Cipher;
7 import javax.crypto.KeyGenerator;
15 * <pre>
16 * ?? DES?DESede(TripleDES,??3DES)?AES?Blowfish?RC2?RC4(ARCFOUR)
17 * DES key size must be equal to 56
19 * AES key size must be equal to 128, 192 or 256,but 192 and 256 bits may not be available
20 * Blowfish key size must be multiple of 8, and can only range from 32 to 448 (inclusive)
21 * RC2 key size must be between 40 and 1024 bits
38 * AES key size must be equal to 128, 192 or 256,but 192 and 256 bits may not be available
39 * Blowfish key size must be multiple of 8, and can only range from 32 to 448 (inclusive)
40 * RC2 key size must be between 40 and 1024 bits
66 // ??????????????AES?Blowfish??????????????????
67 // SecretKey secretKey = new SecretKeySpec(key, ALGORITHM);
__init__.py (https://bitbucket.org/adrians/cryptmd1) Python · 204 lines
__init__.py (https://bitbucket.org/Behemot/university-rep.git) Python · 51 lines
33 Crypto.Cipher.AES Advanced Encryption Standard
34 Crypto.Cipher.ARC2 Alleged RC2
35 Crypto.Cipher.ARC4 Alleged RC4
36 Crypto.Cipher.Blowfish
37 Crypto.Cipher.CAST
38 Crypto.Cipher.DES The Data Encryption Standard. Very commonly used
39 in the past, but today its 56-bit keys are too small.
40 Crypto.Cipher.DES3 Triple DES.
41 Crypto.Cipher.XOR The simple XOR cipher.
44 __all__ = ['AES', 'ARC2', 'ARC4',
45 'Blowfish', 'CAST', 'DES', 'DES3',
46 'XOR'
BlowFishKey.java (http://l2emu.googlecode.com/svn/trunk/) Java · 60 lines
common.py (https://bitbucket.org/galaxy/galaxy-central/) Python · 194 lines
JCEKeyGenerator.java (https://github.com/truedat101/fiskidagur.git) Java · 539 lines
__init__.py (https://bitbucket.org/djlawler/ironpycrypto) Python · 64 lines
33 Crypto.Cipher.AES Advanced Encryption Standard
34 Crypto.Cipher.ARC2 Alleged RC2
35 Crypto.Cipher.ARC4 Alleged RC4
36 Crypto.Cipher.Blowfish
37 Crypto.Cipher.CAST
38 Crypto.Cipher.DES The Data Encryption Standard. Very commonly used
39 in the past, but today its 56-bit keys are too small.
40 Crypto.Cipher.DES3 Triple DES.
41 Crypto.Cipher.XOR The simple XOR cipher.
49 import IronPyCrypto_Cipher_ARC4 as ARC4
50 import IronPyCrypto_Cipher_Blowfish as Blowfish
51 import IronPyCrypto_Cipher_CAST as CAST
nospamform.py (https://github.com/omat/kimlerdensin.git) Python · 40 lines
6 from django.conf import settings
7 from Crypto.Cipher import Blowfish
8 from base64 import b64encode, b64decode
12 def get_key():
13 cobj = Blowfish.new(settings.SECRET_KEY)
14 text = unicode(time())
30 cobj = Blowfish.new(settings.SECRET_KEY)
31 text = cobj.decrypt(b64decode(self.cleaned_data['key'])).rstrip('_')
Encryption.py
(https://bitbucket.org/incubaid/pylabs-core/)
Python · 49 lines
✨ Summary
This Python class, Encryption
, provides a simple encryption method using Blowfish cipher. It generates a unique key based on the machine’s MAC address and uses this to encrypt and decrypt messages. The encrypted message is encoded in base64 and prefixed with a unique identifier to prevent decryption on different machines. This ensures that only the same machine can decrypt the message.
This Python class, Encryption
, provides a simple encryption method using Blowfish cipher. It generates a unique key based on the machine’s MAC address and uses this to encrypt and decrypt messages. The encrypted message is encoded in base64 and prefixed with a unique identifier to prevent decryption on different machines. This ensures that only the same machine can decrypt the message.
8 def __init__(self):
9 self.__blowfish = None
13 if not self.__blowfish:
14 from Crypto.Cipher import Blowfish
15 nics = filter(lambda x: x.startswith("eth") or x.startswith("wlan"), q.system.net.getNics())
20 mac = q.system.net.getMacAddress(nics[0])
21 self.__blowfish = Blowfish.new(mac)
23 return self.__blowfish
24 def encrypt(self, word):
KeyGen.java (http://aionknight.googlecode.com/svn/trunk/) Java · 103 lines
26 import java.security.spec.RSAKeyGenParameterSpec;
27 import javax.crypto.Cipher;
28 import javax.crypto.KeyGenerator;
33 /**
34 * Key generator. It generates keys or keyPairs for Blowfish and RSA
35 */
43 /**
44 * Key generator for blowfish
45 */
46 private static KeyGenerator blowfishKeyGen;
62 blowfishKeyGen = KeyGenerator.getInstance("Blowfish");
BlowFishAlgorithm.java (https://bitbucket.org/shubhamjain2908/test.git) Java · 133 lines
60 skeyString = new String(skey);
61 System.out.println("Blowfish Symmetric key = " + skeyString);
62 }
70 {
71 KeyGenerator kgen = KeyGenerator.getInstance("Blowfish");
72 SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
92 SecretKeySpec skeySpec = new SecretKeySpec(raw, "Blowfish");
93 Cipher cipher = Cipher.getInstance("Blowfish");
94 cipher.init(Cipher.DECRYPT_MODE, skeySpec);
100 {
101 BlowFishAlgorithm bf = new BlowFishAlgorithm();
102 }
108 //import sun.misc.BASE64Encoder;
109 //public class BlowFishAlgorithm {
110 //
TestOfAssembly.java (git://pkgs.fedoraproject.org/java-1.7.0-openjdk) Java · 183 lines
32 import gnu.javax.crypto.assembly.TransformerException;
33 import gnu.javax.crypto.cipher.Blowfish;
34 import gnu.javax.crypto.cipher.IBlockCipher;
66 // build an OFB-Blowfish cascade
67 Cascade ofbBlowfish = new Cascade();
68 Object modeNdx = ofbBlowfish.append(Stage.getInstance(
69 ModeFactory.getInstance(
70 Registry.OFB_MODE, new Blowfish(), 8),
71 Direction.FORWARD));
77 testcase.asm = new Assembly();
78 testcase.asm.addPreTransformer(Transformer.getCascadeTransformer(ofbBlowfish));
79 testcase.asm.addPreTransformer(Transformer.getPaddingTransformer(pkcs7));
KeyGen.java (http://u3j-aion-beta.googlecode.com/svn/trunk/) Java · 99 lines
22 import javax.crypto.Cipher;
23 import javax.crypto.KeyGenerator;
29 /**
30 * Key generator. It generates keys or keyPairs for Blowfish and RSA
31 */
40 /**
41 * Key generator for blowfish
42 */
43 private static KeyGenerator blowfishKeyGen;
59 blowfishKeyGen = KeyGenerator.getInstance("Blowfish");
cipher-blowfish.cabal (git://github.com/vincenthz/hs-cryptocipher.git) Cabal · 55 lines
1 Name: cipher-blowfish
2 Version: 0.0.3
3 Description: Blowfish cipher primitives
4 License: BSD3
8 Maintainer: Vincent Hanquez <vincent@snarc.org>
9 Synopsis: Blowfish cipher
10 Category: Cryptography
21 , crypto-cipher-types >= 0.0.3 && < 0.1
22 Exposed-modules: Crypto.Cipher.Blowfish
23 Other-modules: Crypto.Cipher.Blowfish.Primitive
26 Test-Suite test-cipher-blowfish
27 type: exitcode-stdio-1.0
37 , crypto-cipher-tests
38 , cipher-blowfish
BlowfishCipherService.java (https://github.com/apache/shiro.git) Java · 92 lines
18 */
19 package org.apache.shiro.crypto.cipher;
21 /**
22 * {@code CipherService} using the {@code Blowfish} cipher algorithm for all encryption, decryption, and key operations.
23 * <p/>
24 * The Blowfish algorithm can support key sizes between {@code 32} and {@code 448} bits<b>*</b>, inclusive. However,
25 * modern cryptanalysis techniques render keys of 80 bits or less mostly worthless - use {@code 128} or more whenever
34 * <p/>
35 * <b>*</b> Generating and using Blowfish key sizes greater than 128 require installation of the
36 * <a href="http://java.sun.com/javase/downloads/index.jsp">Java Cryptography Extension (JCE) Unlimited Strength
40 */
41 public class BlowfishCipherService extends DefaultBlockCipherService {
__init__.py (https://bitbucket.org/Behemot/university-rep.git) Python · 33 lines
13 Crypto.Cipher.AES Advanced Encryption Standard
14 Crypto.Cipher.ARC2 Alleged RC2
15 Crypto.Cipher.ARC4 Alleged RC4
16 Crypto.Cipher.Blowfish
17 Crypto.Cipher.CAST
18 Crypto.Cipher.DES The Data Encryption Standard. Very commonly used
19 in the past, but today its 56-bit keys are too small.
20 Crypto.Cipher.DES3 Triple DES.
21 Crypto.Cipher.IDEA
22 Crypto.Cipher.RC5
23 Crypto.Cipher.XOR The simple XOR cipher.
crypto.py (https://github.com/olix0r/pub.git) Python · 48 lines
cryptocipher.cabal (git://github.com/vincenthz/hs-cryptocipher.git) Cabal · 29 lines
GuvnorBootstrapConfiguration.java (https://github.com/bauna/guvnor.git) Java · 137 lines
22 import javax.annotation.PostConstruct;
23 import javax.crypto.Cipher;
24 import javax.crypto.spec.SecretKeySpec;
108 byte[] kbytes = "jaas is the way".getBytes();
109 SecretKeySpec key = new SecretKeySpec(kbytes, "Blowfish");
127 Cipher cipher = Cipher.getInstance("Blowfish");
128 cipher.init(Cipher.DECRYPT_MODE, key);
PickleRPCHandler.py (https://bitbucket.org/rfc1437/toolserver) Python · 83 lines
25 if hasCrypto:
26 from Crypto.Cipher import Blowfish
27 from Crypto.Util.randpool import RandomPool
46 s = decodestring(data)
47 b = Blowfish.new(key, Blowfish.MODE_CBC)
48 s = b.decrypt(s)
60 request._my_secret = genPassword()
61 b = Blowfish.new(request._my_secret, Blowfish.MODE_CBC)
62 res = b.encrypt(res+' '*(8-len(res)%8))
69 request._my_secret = genPassword()
70 b = Blowfish.new(request._my_secret, Blowfish.MODE_CBC)
71 res = b.encrypt(res+' '*(8-len(res)%8))
telnetenable.py (https://gitlab.com/fiddlerwoaroof/netgear-telnetenable) Python · 112 lines
24 from optparse import OptionParser
25 from Crypto.Cipher import Blowfish
26 from Crypto.Hash import MD5
30 # The version of Blowfish supplied for the telenetenable.c implementation
31 # assumes Big-Endian data, but the code does nothing to convert the
33 #
34 # So, since Crypto.Cipher.Blowfish seems to assume native endianness, we need
35 # to byteswap our buffer before and after encrypting it
69 return ByteSwap(Blowfish.new(secret_key, 1).encrypt(payload))
PasswordUtil.java (https://gitlab.com/kidaa/incubator-geode.git) Java · 124 lines
13 import javax.crypto.Cipher;
14 import javax.crypto.spec.SecretKeySpec;
17 * Generates an encrypted password, used by the gemfire encrypt-password
18 * command. Makes use of Blowfish algorithm to encrypt/decrypt password string
19 *
62 try {
63 SecretKeySpec key = new SecretKeySpec(init, "Blowfish");
64 Cipher cipher = Cipher.getInstance("Blowfish");
89 String toDecrypt = password.substring(10, password.length() - 1);
90 SecretKeySpec key = new SecretKeySpec(init, "Blowfish");
91 Cipher cipher = Cipher.getInstance("Blowfish");
crypto.py (https://github.com/weshayutin/rho.git) Python · 147 lines
16 # From the python-crypto package
17 from Crypto.Cipher import Blowfish
95 Uses the Blowfish algorithm. Plaintext will be padded if required.
96 """
97 obj = Blowfish.new(key, Blowfish.MODE_CBC)
108 Uses the Blowfish algorithm. Padding bytes (if present) will be removed.
109 """
110 obj = Blowfish.new(key, Blowfish.MODE_CBC)
111 decrypted_plaintext = obj.decrypt(ciphertext)
Blowfish.java (https://gitlab.com/Lepilov/fdroidclient.git) Java · 75 lines
cryptocipher.cabal (git://github.com/vincenthz/hs-cryptocipher.git) Cabal · 94 lines
35 , cereal
36 Exposed-modules: Crypto.Cipher.RC4
37 Crypto.Cipher.AES
38 Crypto.Cipher.AES.Haskell
39 Crypto.Cipher.Blowfish
40 Crypto.Cipher.Camellia
41 Crypto.Cipher.RSA
42 Crypto.Cipher.DSA
43 Crypto.Cipher.DH
44 other-modules: Number.ModArithmetic
49 Number.Prime
50 Crypto.Cipher.ElGamal
51 ghc-options: -Wall
PickleRPCClient.py (https://bitbucket.org/rfc1437/toolserver) Python · 94 lines
BlowfishEncryptor.java (https://gitlab.com/philip-kissme/plugin-framework.git) Java · 113 lines
11 import javax.crypto.Cipher;
12 import javax.crypto.spec.SecretKeySpec;
22 */
23 public class BlowfishEncryptor implements Encryptor {
25 // private static Logger logger = LoggerFactory.getLogger(BlowfishEncryptor.class);
27 private static String algorithm = "Blowfish/ECB/ZeroBytePadding";
88 //
89 // BlowfishEncryptor encryptor = new BlowfishEncryptor();
90 //
util.py (https://bitbucket.org/galaxy/galaxy-central/) Python · 33 lines
1 from Crypto.Cipher import Blowfish
13 user_hash = ( "!" * ( 8 - len( user_hash ) % 8 ) ) + user_hash
14 cipher = Blowfish.new( str( dataset.create_time ) )
15 user_hash = cipher.encrypt( user_hash ).encode( 'hex' )
27 else:
28 cipher = Blowfish.new( str( dataset.create_time ) )
29 user_id = cipher.decrypt( user_hash.decode( 'hex' ) ).lstrip( "!" )
License.java (http://xerela.googlecode.com/svn/trunk/) Java · 77 lines
BlowFishKey.java (http://l2emu.googlecode.com/svn/trunk/) Java · 46 lines
20 import javax.crypto.Cipher;
24 */
25 public final class BlowFishKey extends GameServerBasePacket
26 {
27 public BlowFishKey(byte[] blowfishKey, RSAPublicKey publicKey)
28 {
34 rsaCipher.init(Cipher.ENCRYPT_MODE, publicKey);
35 encrypted = rsaCipher.doFinal(blowfishKey);
41 {
42 _log.fatal("Error While encrypting blowfish key for transmision (Crypt error)", e);
43 }
Blowfish.patch
(http://tatami.googlecode.com/svn/trunk/)
Patch · 42 lines
✨ Summary
The patch code updates the Blowfish encryption algorithm to handle characters outside the ASCII range (128 and below) by converting them to a value within the 0-255 range, ensuring proper encryption and decryption of all input data.
The patch code updates the Blowfish encryption algorithm to handle characters outside the ASCII range (128 and below) by converting them to a value within the 0-255 range, ensuring proper encryption and decryption of all input data.
1 Index: Blowfish.js
2 ===================================================================
3 --- Blowfish.js (revision 15563)
4 +++ Blowfish.js (working copy)
5 @@ -343,14 +343,14 @@
6 var cipher=[], count=plaintext.length >> 3, pos=0, o={}, isCBC=(mode==dojox.encoding.crypto.cipherModes.CBC);
7 var vector={left:iv.left||null, right:iv.right||null};
CriptografiaService.java (https://github.com/rafabene/PoCs.git) Java · 97 lines
10 import javax.crypto.Cipher;
11 import javax.crypto.spec.SecretKeySpec;
53 byte[] kbytes = chave.getBytes();
54 SecretKeySpec key = new SecretKeySpec(kbytes, "Blowfish");
59 try {
60 Cipher cipher = Cipher.getInstance("Blowfish");
61 cipher.init(Cipher.DECRYPT_MODE, key);
71 byte[] kbytes = chave.getBytes();
72 SecretKeySpec key = new SecretKeySpec(kbytes, "Blowfish");
74 try {
75 Cipher cipher = Cipher.getInstance("Blowfish");
76 cipher.init(Cipher.ENCRYPT_MODE, key);
Benchmarks.hs (git://github.com/vincenthz/hs-cryptocipher.git) Haskell · 114 lines
16 import qualified Crypto.Cipher.AES.Haskell as AES
17 #ifdef HAVE_AESNI
18 import qualified Crypto.Cipher.AES.X86NI as AESNI
19 #endif
20 import qualified Crypto.Cipher.RC4 as RC4
21 import qualified Crypto.Cipher.Blowfish as Blowfish
22 import qualified Crypto.Cipher.Camellia as Camellia
48 (Right blowfishKey) = Blowfish.initKey $ B.empty
49 blowfishEncrypt = Blowfish.encrypt blowfishKey
95 [ ("RC4" , rc4Encrypt)
96 , ("Blowfish" , blowfishEncrypt)
97 , ("Camellia128", camelliaEncrypt128)
BlowFishKey.java (https://bitbucket.org/Rofgar/l2j_server.git) Java · 62 lines
25 import javax.crypto.Cipher;
31 */
32 public class BlowFishKey extends BaseSendablePacket
33 {
34 private static Logger _log = Logger.getLogger(BlowFishKey.class.getName());
36 /**
37 * @param blowfishKey
38 * @param publicKey
39 */
40 public BlowFishKey(byte[] blowfishKey, RSAPublicKey publicKey)
41 {
BlowfishCipher.java (https://github.com/ebonnet/Silverpeas-Core.git) Java · 128 lines
40 *
41 * This implementation wraps the Blowfish cipher provided in the Java Cryptography API and it
42 * performs the redundant operations in the encryption and in the decryption.
46 private final javax.crypto.Cipher cipher;
47 private BlowfishKey blowfishKey = null;
50 blowfishKey = new BlowfishKey();
51 cipher = javax.crypto.Cipher.getInstance(CryptographicAlgorithmName.Blowfish.name());
52 }
60 public CryptographicAlgorithmName getAlgorithmName() {
61 return CryptographicAlgorithmName.Blowfish;
62 }
73 } else {
74 key = new BlowfishKey(keyCode.getRawKey());
75 }
crypt.py (https://github.com/omat/kimlerdensin.git) Python · 111 lines
3 from django.contrib import contenttypes
4 from Crypto.Cipher import Blowfish
5 from base64 import *
23 def cryptString( plain ):
24 obj=Blowfish.new( settings.SECRET_KEY, Blowfish.MODE_ECB)
25 randstring = open("/dev/urandom").read(12)
39 def decryptString( cipher ):
40 obj=Blowfish.new( settings.SECRET_KEY, Blowfish.MODE_ECB)
41 try:
settings.py (https://github.com/mpessas/pimme.git) Python · 90 lines
9 import ConfigParser
10 from Crypto.Cipher import Blowfish, AES
11 import secret_key
29 default['keyring'] = 'user'
30 default['algorithm'] = 'Blowfish'
31 return default
58 alg = config.get('Cryptography', 'algorithm')
59 if alg == 'Blowfish':
60 CipherAlgorithm = Blowfish
79 # Encryption algorithm to use.
80 # Possible values: Blowfish, AES
81 algorithm = Blowfish
LicenseElf.java (http://xerela.googlecode.com/svn/trunk/) Java · 93 lines
BeanTypeListenerTest.java (https://github.com/apache/shiro.git) Java · 130 lines
31 import org.apache.shiro.aop.DefaultAnnotationResolver;
32 import org.apache.shiro.crypto.cipher.BlowfishCipherService;
33 import org.apache.shiro.guice.aop.ShiroAopModule;
70 assertTrue(BeanTypeListener.MATCHER.matches(TypeLiteral.get(DefaultAnnotationResolver.class)));
71 assertTrue(BeanTypeListener.MATCHER.matches(TypeLiteral.get(BlowfishCipherService.class)));
72 }
EncryptUtil.java (https://github.com/vvakame/TwitHubBridge.git) Java · 43 lines
login_details.py (https://github.com/theosp/finance-manager.git) Python · 126 lines
BlockCipherFactory.java (https://code.google.com/p/sshtunnel/) Java · 110 lines
35 ciphers.addElement(new CipherEntry("aes192-cbc", 16, 24,
36 "com.trilead.ssh2.crypto.cipher.AES"));
37 ciphers.addElement(new CipherEntry("aes128-cbc", 16, 16,
38 "com.trilead.ssh2.crypto.cipher.AES"));
39 ciphers.addElement(new CipherEntry("blowfish-cbc", 8, 16,
40 "com.trilead.ssh2.crypto.cipher.BlowFish"));
42 ciphers.addElement(new CipherEntry("aes256-ctr", 16, 32,
43 "com.trilead.ssh2.crypto.cipher.AES"));
44 ciphers.addElement(new CipherEntry("aes192-ctr", 16, 24,
48 ciphers.addElement(new CipherEntry("blowfish-ctr", 8, 16,
49 "com.trilead.ssh2.crypto.cipher.BlowFish"));