Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757448Ab2EIGGG (ORCPT ); Wed, 9 May 2012 02:06:06 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:53119 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751838Ab2EIGF7 (ORCPT ); Wed, 9 May 2012 02:05:59 -0400 MIME-Version: 1.0 Date: Wed, 9 May 2012 00:05:58 -0600 Message-ID: Subject: [ANNOUNCE] Blowfish PHP implementation for Linux (fast, easier to maintain, and doesn't require Linux PEAR and all those wierd bin modules) From: Jeffrey Merkey To: linux-kernel Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 18149 Lines: 435 If anyone needs it, a lot easier to use than the Linux PHP encryption bin tools with PEAR, which most ISPs these days not only don't have PEAR working right, don't even go near any of the DOM PHP functions on Linux -- totally busted -- lib overlays cause memory corruption. You have to be good at using preg_replace and preg_match with godaddy these days and most ISPs because the Linux PEAR stuff is BUSTED out in the real world and the Linux PHP DOM stuff is CORRUPTED out in the real world. Enjoy Love You Guys. Jeff >= 8; $c = ($x & 0xFF); $x >>= 8; $b = ($x & 0xFF); $x >>= 8; $a = ($x & 0xFF); $y = $this->S[0][$a] + $this->S[1][$b]; $y = $y ^ $this->S[2][$c]; $y = $y + $this->S[3][$d]; return $y; } function Blowfish_Encrypt($lr = array()) { $Xl = $lr[0]; $Xr = $lr[1]; for ($i = 0; $i < $this->N; ++$i) { $Xl = $Xl ^ $this->P[$i]; $Xr = $this->F($Xl) ^ $Xr; $temp = $Xl; $Xl = $Xr; $Xr = $temp; } $temp = $Xl; $Xl = $Xr; $Xr = $temp; $Xr = $Xr ^ $this->P[$this->N]; $Xl = $Xl ^ $this->P[$this->N + 1]; $lr[0] = $Xl; $lr[1] = $Xr; return $lr; } function Blowfish_Decrypt($lr = array()) { $Xl = $lr[0]; $Xr = $lr[1]; for ($i = $this->N + 1; $i > 1; --$i) { $Xl = $Xl ^ $this->P[$i]; $Xr = $this->F($Xl) ^ $Xr; // Exchange Xl and Xr $temp = $Xl; $Xl = $Xr; $Xr = $temp; } // Exchange Xl and Xr $temp = $Xl; $Xl = $Xr; $Xr = $temp; $Xr = $Xr ^ $this->P[1]; $Xl = $Xl ^ $this->P[0]; $lr[0] = $Xl; $lr[1] = $Xr; return $lr; } function Blowfish_Init($key, $keylen) { $datalr = array(); for ($i = 0; $i < 4; $i++) { for ($j = 0; $j < 256; $j++) $this->S[$i][$j] = $this->ORIG_S[$i][$j]; } $j = 0; for ($i = 0; $i < ($this->N + 2); ++$i) { $data = 0x00000000; for ($k = 0; $k < 4; ++$k) { $data = ($data << 8) | $key[$j]; $j = $j + 1; if ($j >= $keylen) $j = 0; } $this->P[$i] = $this->ORIG_P[$i] ^ $data; } $datal = 0x00000000; $datar = 0x00000000; for ($i = 0; $i < ($this->N + 2); $i += 2) { $lr[0] = $datal; $lr[1] = $datar; $lr = $this->Blowfish_Encrypt($lr); $this->P[$i] = $lr[0]; $this->P[$i + 1] = $lr[1]; } for ($i = 0; $i < 4; ++$i) { for ($j = 0; $j < 256; $j += 2) { $lr[0] = $datal; $lr[1] = $datar; $lr = $this->Blowfish_Encrypt($lr); $this->S[$i][$j] = $lr[0]; $this->S[$i][$j + 1] = $lr[1]; } } } } ?> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/