Skip to content

Instantly share code, notes, and snippets.

@ormaaj
Last active July 29, 2016 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ormaaj/fbde9e2c0a22d0bfadb52055631e39a0 to your computer and use it in GitHub Desktop.
Save ormaaj/fbde9e2c0a22d0bfadb52055631e39a0 to your computer and use it in GitHub Desktop.
class Program {
static void Main(string[] args) {
var dict = new ConcurrentDictionary<string, ConcurrentBag<string>>();
Directory.GetFiles("/home/ormaaj/doc/text/ebooks/programming/unsorted")
.AsParallel()
.ForAll(x => dict.AddOrUpdate(
BitConverter.ToString(SHA256.Create().ComputeHash(File.OpenRead(x))),
new ConcurrentBag<string>() { x },
(y, z) => { z.Add(y); return z; }));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment