2004-04-05 Bernie Solomon <bernard@ugsolutions.com>
authorBernie Solomon <bernard@mono-cvs.ximian.com>
Mon, 5 Apr 2004 23:23:32 +0000 (23:23 -0000)
committerBernie Solomon <bernard@mono-cvs.ximian.com>
Mon, 5 Apr 2004 23:23:32 +0000 (23:23 -0000)
* DESCryptoServiceProvider.cs: Use BitConverter.IsLittleEndian
to fix for big endian machines.

svn path=/trunk/mcs/; revision=25066

mcs/class/corlib/System.Security.Cryptography/ChangeLog
mcs/class/corlib/System.Security.Cryptography/DESCryptoServiceProvider.cs

index 7823c76f55f2d38aff727ea5b623859de208075c..47f3755c464e329fb864c19a926a0a05c7ae263f 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-05  Bernie Solomon  <bernard@ugsolutions.com>
+
+       * DESCryptoServiceProvider.cs: Use BitConverter.IsLittleEndian
+       to fix for big endian machines.
+
 2004-03-10  Sebastien Pouliot  <sebastien@ximian.com>
 
        * FromBase64Transform.cs: Now throws ObjectDisposedException and
index 3d267af97602975195d4835553cfffe0a3a523e0..216031540ac6b9c0928134b921d198581ef4161f 100644 (file)
@@ -254,7 +254,7 @@ namespace System.Security.Cryptography {
        
                private static void Permutation (byte [] input, byte [] _output, int [] permTab, bool preSwap)
                {
-                       if (preSwap) BSwap (input);
+                       if (preSwap && BitConverter.IsLittleEndian) BSwap (input);
        
                        byte [] output = _output;
        
@@ -275,7 +275,7 @@ namespace System.Security.Cryptography {
                                d2 |= permTab [offs1]   | permTab [offs2];
                        }
        
-                       if (preSwap) {
+                       if (preSwap || !BitConverter.IsLittleEndian) {
                                output [0] = (byte) (d1);
                                output [1] = (byte) (d1 >> 8);
                                output [2] = (byte) (d1 >> 16);