lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0805191859411.18461@visualserver.org>
Date:	Mon, 19 May 2008 19:04:55 +0200 (CEST)
From:	Soumyadip Das Mahapatra <kernelhacker@...ualserver.org>
To:	linux-kernel@...r.kernel.org
cc:	akinobu.mita@...il.com
Subject: [PATCH 1/2] bitreversal program

--- a/include/linux/bitrev.h    2008-04-17 08:19:44.000000000 +0530
+++ b/include/linux/bitrev.h    2008-05-19 21:49:46.000000000 +0530
@@ -3,11 +3,32 @@

  #include <linux/types.h>

-extern u8 const byte_rev_table[256];
+/**
+ * Here is a generalised bit reversal program
+ * @x: word to get bits reversed
+ * @k: key, explained below
+ * for k = 31, it reverses the bits of word(32 bit)
+ * for k = 24, it reverses the bytes in word
+ * for k = 7, it reverses the bits in every byte without
+ * changing the positions of bytes in a word
+ * and for k = 16 it swaps the left and right halves of a
+ * word
+ */

-static inline u8 bitrev8(u8 byte)
+static inline u32 gen_bit_rev(u32 x, u32 k)
  {
-       return byte_rev_table[byte];
+       if(k & 1)
+               x = (x & 0x55555555) << 1 | (x & 0xaaaaaaaa) >> 1;
+       if(k & 2)
+               x = (x & 0x33333333) << 2 | (x & 0xcccccccc) >> 2;
+       if(k & 4)
+               x = (x & 0x0f0f0f0f) << 4 | (x & 0xf0f0f0f0) >> 4;
+       if(k & 8)
+               x = (x & 0x00ff00ff) << 8 | (x & 0xff00ff00) >> 8;
+       if(k & 16)
+               x = (x & 0x0000ffff) << 16 | (x & 0xffff0000) >> 16;
+
+       return x;
  }

  extern u32 bitrev32(u32 in);

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ