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-prev] [thread-next>] [day] [month] [year] [list]
Date:	11 Aug 2011 11:34:01 -0400
From:	"George Spelvin" <linux@...izon.com>
To:	akpm@...ux-foundation.org, fzago@...temfabricworks.com,
	joakim.tjernlund@...nsmode.se, linux-kernel@...r.kernel.org,
	linux@...izon.com, rpearson@...temfabricworks.com
Subject: Re: [patch v5 7/8] crc32-add-slicing-by-8.diff

I don't know if you care, but here's some slightly more compact code for
creating the tables.  It produces the same results, and I don't think
it's any slower.

I can explain it if anyone's confused, but it's hopefully fairly
easy to figure out assuming a backgriund in CRC math.

(Tested against existing code, not in kernel.)
Signed-off-by: George Spelvin <linux@...izon.com>

static void crc32init_le(void)
{
	unsigned i, j, k;
	uint32_t crc = 1;

	for (i = 0; i < LE_TABLE_ROWS; i++) {
		crc32table_le[i][0] = 0;
		for (j = LE_TABLE_SIZE >> 1; j; j >>= 1) {
			crc = (crc >> 1) ^ (crc & 1 ? CRCPOLY_LE : 0);
			for (k = 0; k < LE_TABLE_SIZE; k += 2 * j)
				crc32table_le[i][j + k] = crc ^ crc32table_le[i][k];
		}
	}
}

static void crc32init_be(void)
{
	unsigned i, j, k;
	uint32_t crc = 0x80000000;

	for (i = 0; i < BE_TABLE_ROWS; i++) {
		crc32table_be[i][0] = 0;
		for (j = 1; j < BE_TABLE_SIZE; j <<= 1) {
			crc = (crc << 1) ^ (crc & 0x80000000 ? CRCPOLY_BE : 0);
			for (k = 0; k < j; k++)
				crc32table_be[i][j + k] = crc ^ crc32table_be[i][k];
		}
	}
}
--
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