wasSharp – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
39 | office | 1 | /////////////////////////////////////////////////////////////////////////// |
2 | // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // |
||
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
||
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
||
5 | /////////////////////////////////////////////////////////////////////////// |
||
6 | |||
7 | using System; |
||
8 | using System.Threading.Tasks; |
||
9 | |||
10 | namespace wasSharp |
||
11 | { |
||
12 | public static class Extensions |
||
13 | { |
||
14 | /// <summary> |
||
15 | /// Combine two UUIDs together by taking the MD5 hash of a byte array |
||
16 | /// containing both UUIDs |
||
17 | /// </summary> |
||
18 | /// <param name="first">First UUID to combine</param> |
||
19 | /// <param name="second">Second UUID to combine</param> |
||
20 | /// <returns>The UUID product of the combination</returns> |
||
21 | public static Guid CombineXOR(this Guid p, Guid q) |
||
22 | { |
||
23 | var l = p.ToByteArray(); |
||
24 | var r = q.ToByteArray(); |
||
25 | byte[] combine = new byte[16]; |
||
26 | Parallel.For(0, 16, i => |
||
27 | { |
||
28 | combine[i] = (byte)(l[i] ^ r[i]); |
||
29 | }); |
||
30 | |||
31 | return new Guid(combine); |
||
32 | } |
||
33 | } |
||
34 | } |