Not logged in
Log in now
Create an account
Subscribe to LWN
Recent Features
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
PostgreSQL 9.3 beta: Federated databases and more
LWN.net Weekly Edition for May 9, 2013
Why not just use the SHA1 only?
Posted May 23, 2010 10:57 UTC (Sun) by johill (subscriber, #25196) [Link]
+#define PAGECMP_OFFSET 128 +#define PAGEHASH_SIZE (PAGECMP_OFFSET ? PAGECMP_OFFSET : PAGE_SIZE) +/* hash the page */ +static void page_hash(struct page *page, unsigned char *digest) +{ + struct scatterlist sg; + struct hash_desc desc; + + sg_init_table(&sg, 1); + sg_set_page(&sg, page, PAGEHASH_SIZE, 0); + desc.tfm = tfm; + desc.flags = 0; + crypto_hash_digest(&desc, &sg, PAGEHASH_SIZE, digest); +}
Copyright © 2013, Eklektix, Inc. Comments and public postings are copyrighted by their creators. Linux is a registered trademark of Linus Torvalds