This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Used to exchange symmetric keys | |
| private static int RsaKeySize = 2048; | |
| private void CreateKeys() | |
| { | |
| using(var provider = new RSACryptoServiceProvider(RsaKeySize)) | |
| { | |
| provider.PersistKeyInCsp = false; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary>Takes a list of values and scales the values, so that the sum of the result is always 1 (100%).</summary> | |
| /// <param name="values">A list of values that need to be scaled.</param> | |
| /// <returns>Scaled values, from which the sum is 1.</returns> | |
| let scaleSoThatSumIsOne (values:seq<decimal>) = | |
| let Σ = Seq.sum values | |
| match Σ with | |
| | 0.0m -> | |
| let n = decimal (Seq.length values) | |
| seq { | |
| for p in values do |
NewerOlder