Exemplo n.º 1
0
        public void Load(BinaryReader br)
        {
            br.ReadByte(); // version
            byte[] Bytes = br.ReadBytes(20);

            Hash = SHA1Hash.FromBytes(Bytes);
        }
Exemplo n.º 2
0
        public async Task<string> Decrypt(string encryptedPremiumToken, string apiKey) {
            var aes = new Aes();
            var sha1 = new SHA1Hash();

            var keyHash = await sha1.GetHashAsync(apiKey).ConfigureAwait(false);
            var unencryptedPremiumToken =
                await aes.DecryptAsync(encryptedPremiumToken, keyHash).ConfigureAwait(false);
            return unencryptedPremiumToken;
        }
Exemplo n.º 3
0
            public NodesWithHash(double[] lats, double[] lons)
            {
                this.lats = lats;
                this.lons = lons;

                int N        = lats.Length;
                int elemSize = sizeof(double);

                byte[] bytes = new byte[N * 3 * elemSize];
                for (int i = 0; i < N; i++)
                {
                    byte[] h1 = BitConverter.GetBytes(lats[i]);
                    byte[] h2 = BitConverter.GetBytes(lons[i]);
                    Buffer.BlockCopy(h1, 0, bytes, elemSize * i * 2, elemSize);
                    Buffer.BlockCopy(h2, 0, bytes, elemSize * i * 2 + elemSize, elemSize);
                }

                hash     = SHA1Hash.HashAsync(bytes).Result;
                hashCode = BitConverter.ToInt32(BitConverter.GetBytes(hash), 0);
            }
Exemplo n.º 4
0
        public void SHA1_Should_CalculateCorrectHashBytes_When_ProvidedStream()
        {
            // Arrange
            var expected = new byte[]
            {
                0xb2, 0x9f, 0xe3, 0xad, 0x6f, 0xd6, 0x8c, 0x8b, 0x2c, 0x71,
                0xc6, 0x09, 0x94, 0x89, 0x29, 0x52, 0x5d, 0x21, 0x85, 0xd2
            };

            byte[] actual;

            // Act
            using (var sr = new StreamReader($"{_assemblyPath}gettysburg.txt"))
            {
                actual = SHA1Hash.Create().ComputeToBytes(sr.BaseStream);
            }

            // Assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 5
0
        public void SHA1_Should_CalculateCorrectHashBytes_When_ProvidedWithBytes()
        {
            // Arrange
            var data = new byte[]
            {
                0x55, 0x6e, 0x69, 0x74, 0x54, 0x65, 0x73, 0x74
            };

            var expected = new byte[]
            {
                0xce, 0x04, 0xfe, 0x35, 0x7b, 0xc6, 0x7b, 0xe9, 0xbe, 0x8f,
                0x97, 0xf0, 0xa0, 0x7e, 0x36, 0xdc, 0x7b, 0x63, 0xed, 0xfc
            };

            // Act
            var actual = SHA1Hash.Create().ComputeToBytes(data);

            // Assert
            Assert.Equal(expected, actual);
        }
        public IActionResult SHA1Encrypt([FromBody] HashViewModel viewModel)
        {
            SHA1Hash hash = new SHA1Hash();


            string encrypted = "";

            try
            {
                encrypted = hash.Encrypt(viewModel.Message);
            }
            catch (NullReferenceException)
            {
            }
            catch (Exception)
            {
                return(BadRequest(new { Result = false, Message = Text.InvalidCharacter }));
            }
            return(Json(encrypted));
        }
Exemplo n.º 7
0
        public void ShouldHashReadOnlySpan()
        {
            using (var sha1 = new SHA1Hash())
            {
                var data = new byte[1] {
                    49
                };
                sha1.UpdateData(data);
                sha1.Finish();
                Assert.AreEqual("356A192B7913B04C54574D18C28D46E6395428AB", ByteArrayToHexStr(sha1.GetDigest()));

                sha1.Initialize();
                data = new byte[2] {
                    49, 50
                };
                sha1.UpdateData(data);
                sha1.Finish();
                Assert.AreEqual("7B52009B64FD0A2A49E6D8A939753077792B0554", ByteArrayToHexStr(sha1.GetDigest()));
            }
        }
Exemplo n.º 8
0
            public NodesWithHash(double[] lats, double[] lons, double[] vals)
                : base(lats, lons, vals)
            {
                int N        = lats.Length;
                int elemSize = sizeof(double);

                byte[] bytes = new byte[N * 3 * elemSize];
                for (int i = 0; i < N; i++)
                {
                    byte[] h1 = BitConverter.GetBytes(Lats[i]);
                    byte[] h2 = BitConverter.GetBytes(Lons[i]);
                    byte[] h3 = BitConverter.GetBytes(Values[i]);
                    Buffer.BlockCopy(h1, 0, bytes, elemSize * i * 3, elemSize);
                    Buffer.BlockCopy(h2, 0, bytes, elemSize * i * 3 + elemSize, elemSize);
                    Buffer.BlockCopy(h3, 0, bytes, elemSize * i * 3 + 2 * elemSize, elemSize);
                }

                hash     = SHA1Hash.HashAsync(bytes).Result;
                hashCode = BitConverter.ToInt32(BitConverter.GetBytes(hash), 0);
            }
Exemplo n.º 9
0
        public void TestSHA1()
        {
            HashAdapter hash    = new SHA1Hash();
            string      src1    = @"ABC";
            string      result1 = hash.ComputeHash(src1);

            Assert.AreEqual(40, result1.Length);
            string hashed1 = @"3c01bdbb26f358bab27f267924aa2c9a03fcfdb8";

            Assert.AreEqual(hashed1, result1);

            // 日本語を含む文字列は?
            string src2    = @"あいう";
            string result2 = hash.ComputeHash(src2);

            Assert.AreEqual(40, result2.Length);
            string hashed2 = @"eb636ba7c320e00b3749ad404b7adc7609560dee";

            Assert.AreEqual(hashed2, result2);
        }
Exemplo n.º 10
0
        private string ToStringAncestorUnids(int indent)
        {
            const int xNamePad     = 16;
            string    indentString = "".PadRight(indent);

            var sb = new StringBuilder();

            sb.Append(indentString);

            var correlationStatus = "";

            if (CorrelationStatus != CorrelationStatus.Nil)
            {
                correlationStatus = $"[{CorrelationStatus.ToString().PadRight(8)}] ";
            }

            if (ContentElement.Name == W.t || ContentElement.Name == W.delText)
            {
                sb.AppendFormat(
                    "Atom {0}: {1} {2} SHA1:{3} ",
                    PadLocalName(xNamePad, this),
                    ContentElement.Value,
                    correlationStatus,
                    SHA1Hash.Substring(0, 8));

                AppendAncestorsUnidsDump(sb, this);
            }
            else
            {
                sb.AppendFormat(
                    "Atom {0}:   {1} SHA1:{2} ",
                    PadLocalName(xNamePad, this),
                    correlationStatus,
                    SHA1Hash.Substring(0, 8));

                AppendAncestorsUnidsDump(sb, this);
            }

            return(sb.ToString());
        }
Exemplo n.º 11
0
        public bool LoadChunk(SHA1Hash id, long variantSize, long originalSize, Stream output, bool noPatching)
        {
            ChunkLoader             chunkLoader;
            List <ChunkVariantInfo> chunkVariants;

            if (this.FindChunk(id, out chunkLoader, out chunkVariants) == false)
            {
                return(false);
            }

            foreach (var chunkVariant in chunkVariants)
            {
                var type  = chunkVariant.Type;
                var index = chunkVariant.Index;

                if (type == ChunkVariantType.Normal)
                {
                    if (this.LoadNormalChunk(chunkLoader, index, variantSize, originalSize, output) == true)
                    {
                        return(true);
                    }
                }
                else if (noPatching == false && type == ChunkVariantType.Patch)
                {
                    if (this.LoadPatchChunk(chunkLoader, index, variantSize, originalSize, output) == true)
                    {
                        return(true);
                    }
                }
                else if (type == ChunkVariantType.Encrypted)
                {
                    if (this.LoadEncryptedChunk(chunkLoader, index, variantSize, originalSize, output) == true)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 12
0
        public void ShouldHashAsStandardSha1()
        {
            using (var sha1 = new SHA1Hash())
            {
                var data1 = new byte[1] {
                    49
                };
                var data2 = new byte[2] {
                    49, 50
                };

                sha1.UpdateData(data1);
                sha1.UpdateData(data2);
                sha1.Finish();

                var stdSha1 = System.Security.Cryptography.SHA1.Create();
                stdSha1.TransformBlock(data1, 0, 1, null, 0);
                stdSha1.TransformBlock(data2, 0, 2, null, 0);
                stdSha1.TransformFinalBlock(Array.Empty <byte>(), 0, 0);

                CollectionAssert.AreEqual(sha1.GetDigest().ToArray(), stdSha1.Hash);
            }
        }
Exemplo n.º 13
0
        public static byte[] Get411Password(string password, string seed)
        {
            if (password.Length == 0)
            {
                return(new byte[1]);
            }
            SHA1Hash hash = new SHA1Hash();

            byte[] buffer           = hash.ComputeHash(Encoding.Default.GetBytes(password));
            byte[] sourceArray      = hash.ComputeHash(buffer);
            byte[] bytes            = Encoding.Default.GetBytes(seed);
            byte[] destinationArray = new byte[bytes.Length + sourceArray.Length];
            Array.Copy(bytes, 0, destinationArray, 0, bytes.Length);
            Array.Copy(sourceArray, 0, destinationArray, bytes.Length, sourceArray.Length);
            byte[] buffer5 = hash.ComputeHash(destinationArray);
            byte[] buffer6 = new byte[buffer5.Length + 1];
            buffer6[0] = 20;
            Array.Copy(buffer5, 0, buffer6, 1, buffer5.Length);
            for (int i = 1; i < buffer6.Length; i++)
            {
                buffer6[i] = (byte)(buffer6[i] ^ buffer[i - 1]);
            }
            return(buffer6);
        }
Exemplo n.º 14
0
        public bool GetChunkId(Guid guid, out SHA1Hash sha1, out long size)
        {
            var superbundleChunkInfo =
                this._Superbundles
                .Values
                .Where(sb => sb.Bundles != null)
                .SelectMany(sb => sb.Bundles)
                .Where(bi => bi.Chunks != null)
                .SelectMany(bi => bi.Chunks)
                .FirstOrDefault(ci => ci.Id == guid);

            if (superbundleChunkInfo != null)
            {
                sha1 = superbundleChunkInfo.SHA1;
                size = superbundleChunkInfo.Size;
                return(true);
            }

            var tableOfContentsChunkInfo =
                this._TableOfContents
                .Values
                .Where(toc => toc.Chunks != null)
                .SelectMany(toc => toc.Chunks)
                .FirstOrDefault(ci => ci.Id == guid);

            if (tableOfContentsChunkInfo != null)
            {
                sha1 = tableOfContentsChunkInfo.SHA1;
                size = 0;
                return(true);
            }

            sha1 = default(SHA1Hash);
            size = 0;
            return(false);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Generate a scrambled password for 4.1.0 using new passwords
        /// </summary>
        /// <param name="password">The password to scramble</param>
        /// <param name="seedBytes">The seedbytes used to scramble</param>
        /// <returns>Array of bytes containing the scrambled password</returns>
        public static byte[] Get410Password(string password, byte[] seedBytes)
        {
            SHA1Hash sha = new SHA1Hash();

            //SHA1 sha = new SHA1CryptoServiceProvider();

            // clean it and then digest it
            password = password.Replace(" ", "").Replace("\t", "");
            byte[] passBytes = System.Text.Encoding.Default.GetBytes(password);
            byte[] firstPass = sha.ComputeHash(passBytes);

            byte[] input = new byte[24];
            Array.Copy(seedBytes, 0, input, 0, 4);
            Array.Copy(firstPass, 0, input, 4, 20);
            byte[] secondPass = sha.ComputeHash(input);

            byte[] scrambledBuff = new byte[20];
            XorScramble(seedBytes, 4, scrambledBuff, 0, secondPass, 20);

            byte[] finalBuff = new byte[20];
            XorScramble(scrambledBuff, 0, finalBuff, 0, firstPass, 20);

            return(finalBuff);
        }
Exemplo n.º 16
0
            async Task <PremiumAccessToken> GetPremiumTokenInternal(string encryptedPremiumToken, string apiKey)
            {
                var premiumToken = DomainEvilGlobal.Settings.AccountOptions.UserInfo.Token;

                try {
                    var premiumCached = _firstCompleted && premiumToken.IsPremium() &&
                                        premiumToken.IsValidInNearFuture();
                    if (!premiumCached)
                    {
                        var aes  = new Aes();
                        var sha1 = new SHA1Hash();

                        var keyHash = await sha1.GetHashAsync(apiKey).ConfigureAwait(false);

                        var unencryptedPremiumToken =
                            await aes.DecryptAsync(encryptedPremiumToken, keyHash).ConfigureAwait(false);

                        premiumToken = JsonConvert.DeserializeObject <PremiumAccessToken>(unencryptedPremiumToken);
                    }
                } catch (NotPremiumUserException) {
                    premiumToken = null;
                }
                return(premiumToken);
            }
Exemplo n.º 17
0
            async Task<PremiumAccessToken> GetPremiumTokenInternal(string encryptedPremiumToken, string apiKey) {
                var premiumToken = _settings.AccountOptions.UserInfo.Token;
                try {
                    var premiumCached = _firstCompleted && premiumToken.IsPremium() &&
                                        premiumToken.IsValidInNearFuture();
                    if (!premiumCached) {
                        var aes = new Aes();
                        var sha1 = new SHA1Hash();

                        var keyHash = await sha1.GetHashAsync(apiKey).ConfigureAwait(false);
                        var unencryptedPremiumToken =
                            await aes.DecryptAsync(encryptedPremiumToken, keyHash).ConfigureAwait(false);
                        premiumToken = JsonConvert.DeserializeObject<PremiumAccessToken>(unencryptedPremiumToken);
                    }
                } catch (NotPremiumUserException) {
                    premiumToken = null;
                }
                return premiumToken;
            }
Exemplo n.º 18
0
        // Methods
        public override async Task <StepResults> Perform(Dictionary <string, object> variableCache, IProgress <ProgressReport> progress)
        {
            var column = StartMessage.Trim().Length > 0 ? ": " : "";

            var progressReport = new ProgressReport();
            var stepResults    = new StepResults {
                Message = column + Common.ProcessVariableTokens(ValidMessage, variableCache), Status = StepStatus.Success
            };

            progress.Report(new ProgressReport {
                Message = Common.ProcessVariableTokens(StartMessage, variableCache), Percentage = 0, NewLine = false
            });
            await Task.Delay(10);

            if ((Variable == string.Empty && Path == string.Empty) || (Variable != string.Empty && !variableCache.ContainsKey(Variable)))
            {
                stepResults.Message = $"{column}A file was not provided.";
                stepResults.Status  = StepStatus.Failure;
            }
            else if (Hash == string.Empty)
            {
                stepResults.Message = $"{column}A hash was not provided.";
                stepResults.Status  = StepStatus.Failure;
            }

            var file = string.Empty;

            if (stepResults.Status == StepStatus.Success)
            {
                if (variableCache.ContainsKey(Variable))
                {
                    file = variableCache[Variable].ToString();
                }
                else
                {
                    file = Common.ProcessVariableTokens(Path, variableCache);
                }

                if (!File.Exists(file))
                {
                    stepResults.Message = $"{column}The file provided does not exist.";
                    stepResults.Status  = StepStatus.Failure;
                }
            }

            var result = string.Empty;

            if (stepResults.Status == StepStatus.Success)
            {
                switch (Type)
                {
                case HashTypes.None:
                    stepResults.Message = $"{column}A hash type was not selected.";
                    stepResults.Status  = StepStatus.Failure;
                    break;

                case HashTypes.SHA1:
                    result = await SHA1Hash.ComputeHashAsync(File.OpenRead(file), progress);

                    if (Hash.ToUpper() != result)
                    {
                        stepResults.Message = $"\r\nExpected {Hash.ToUpper()} but got {result.ToUpper()} instead.\r\n" + Common.ProcessVariableTokens(InvalidMessage, variableCache);
                        stepResults.Status  = StepStatus.Failure;
                    }
                    break;

                case HashTypes.SHA256:
                    result = await SHA256Hash.ComputeHashAsync(File.OpenRead(file), progress);

                    if (Hash.ToUpper() != result)
                    {
                        stepResults.Message = $"\r\nExpected {Hash.ToUpper()} but got {result.ToUpper()} instead.\r\n" + Common.ProcessVariableTokens(InvalidMessage, variableCache);
                        stepResults.Status  = StepStatus.Failure;
                    }
                    break;
                }
            }

            progress.Report(progressReport);
            return(stepResults);
        }
Exemplo n.º 19
0
        public void Sha1(string a, ulong hash)
        {
            IFileHash h = new SHA1Hash();

            Assert.Equal(hash, h.GetHash(Encoding.Unicode.GetBytes(a)));
        }
Exemplo n.º 20
0
        // Methods
        public override async Task <StepResults> Perform(Dictionary <string, object> variableCache, IProgress <ProgressReport> progress)
        {
            var progressReport = new ProgressReport();
            var stepResults    = new StepResults {
                Message = Common.ProcessVariableTokens(ValidMessage, variableCache), Status = StepStatus.Success
            };

            Hash = Hash.ToUpper();

            progress.Report(new ProgressReport {
                Message = StartMessage, Percentage = 0
            });

            if (Variable == string.Empty || !variableCache.ContainsKey(Variable))
            {
                stepResults.Message = $"{Name}: A file was not provided.";
                stepResults.Status  = StepStatus.Failure;
            }
            else if (!File.Exists(variableCache[Variable].ToString()))
            {
                stepResults.Message = $"{Name}: The file provided does not exist.";
                stepResults.Status  = StepStatus.Failure;
            }
            else if (Hash == string.Empty)
            {
                stepResults.Message = $"{Name}: A hash was not provided.";
                stepResults.Status  = StepStatus.Failure;
            }

            var result = string.Empty;

            if (stepResults.Status == StepStatus.Success)
            {
                switch (Type)
                {
                case HashTypes.None:
                    stepResults.Message = $"{Name}: A hash type was not selected.";
                    stepResults.Status  = StepStatus.Failure;
                    break;

                case HashTypes.SHA1:
                    result = await SHA1Hash.ComputeHashAsync(File.OpenRead(variableCache[Variable].ToString()), progress);

                    if (Hash != result)
                    {
                        stepResults.Message = $"Expected {Hash} but got {result} instead.\r\n" + Common.ProcessVariableTokens(InvalidMessage, variableCache);
                        stepResults.Status  = StepStatus.Failure;
                    }
                    break;

                case HashTypes.SHA256:
                    result = await SHA256Hash.ComputeHashAsync(File.OpenRead(variableCache[Variable].ToString()), progress);

                    if (Hash != result)
                    {
                        stepResults.Message = $"Expected {Hash} but got {result} instead.\r\n" + Common.ProcessVariableTokens(InvalidMessage, variableCache);
                        stepResults.Status  = StepStatus.Failure;
                    }
                    break;
                }
            }

            progress.Report(progressReport);
            return(stepResults);
        }
Exemplo n.º 21
0
 internal ModReleaseInfo(AccurateVersion version, string downloadUrl, string fileName,
                         DateTime releaseDate, SHA1Hash checksum, ModInfo info)
 => (Version, DownloadUrl, FileName, ReleaseDate, Checksum, Info)
Exemplo n.º 22
0
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            string senha = SHA1Hash.SHA1UTF8(Login1.Password);

            hashgen.Value = senha;
        }
Exemplo n.º 23
0
        public void SHA1HashConstructorTest()
        {
            SHA1Hash target = new SHA1Hash();

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
Exemplo n.º 24
0
        public EstimationResult EstimateAlgorithm(ISearchAlgorithm algorithm, object parameters = null)
        {
            if (algorithm == null)
            {
                throw new ArgumentNullException("algorithm");
            }

            Dictionary <SHA1Hash, Dictionary <SHA1Hash, int> > AutoScores = new Dictionary <SHA1Hash, Dictionary <SHA1Hash, int> >();

            List <Audio> Audios        = Core.GetAudios().ToList();
            List <Audio> ReferenceList = Audios.ToList();

            foreach (Audio ReferenceAudio in ReferenceList)
            {
                IList <Audio> Series = Audios.Search(ReferenceAudio, algorithm, parameters)
                                       .Where(audio => HashMap.Contains(audio.GetHash()))
                                       .ToList();

                SHA1Hash ReferenceHash = ReferenceAudio.GetHash();

                AutoScores.Add(ReferenceHash, new Dictionary <SHA1Hash, int>());

                int Rank = 0;
                foreach (Audio TargetAudio in Series)
                {
                    AutoScores[ReferenceHash].Add(TargetAudio.GetHash(), TransformRankToScore(Rank++, Series.Count));
                }
            }

            List <double> Errors                = new List <double>();
            List <double> ManualScoresList      = new List <double>();
            List <double> ReducedAutoScoresList = new List <double>();

            foreach (SHA1Hash Reference in ManualScores.Keys)
            {
                foreach (SHA1Hash Target in ManualScores[Reference].Keys)
                {
                    if (AutoScores.ContainsKey(Reference) && AutoScores[Reference].ContainsKey(Target))
                    {
                        int ReferenceScore = ManualScores[Reference][Target];

                        int AutoScore = AutoScores[Reference][Target];

                        int Error = ReferenceScore - AutoScore;

                        Errors.Add(Error);
                        ManualScoresList.Add(ReferenceScore);
                        ReducedAutoScoresList.Add(AutoScore);
                    }
                }
            }

            double Mean = Errors.Mean();

            double StandardDeviation = Errors.StandardDeviation();

            double Covariance   = ManualScoresList.Covariance(ReducedAutoScoresList);
            double PearsonCoeff = Correlation.Pearson(ManualScoresList, ReducedAutoScoresList);

            EstimationResult Result = new EstimationResult()
            {
                AlgorithmName     = algorithm.DisplayName,
                Parameters        = Convert.ToString(parameters),
                Mean              = Mean,
                StandardDeviation = StandardDeviation,
                Covariance        = Covariance,
                PearsonCoeff      = PearsonCoeff,
                Scores            = AutoScores
            };

            return(Result);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Generates a proper hash for old style 4.1.0 passwords.  This would be used
        /// if a 4.1.0 server contained old 16 byte hashes.
        /// </summary>
        /// <param name="password">The password to hash</param>
        /// <param name="seedBytes">Seed bytes received from the server</param>
        /// <returns>Byte array containing the password hash</returns>
        public static byte[] GetOld410Password(string password, byte[] seedBytes)
        {
            long[] passwordHash = Hash(password);
            string passHex      = String.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                "{0,8:X}{1,8:X}", passwordHash[0], passwordHash[1]);

            int[] salt = getSaltFromPassword(passHex);

            // compute binary password
            byte[] binaryPassword = new byte[20];
            int    offset         = 0;

            for (int i = 0; i < 2; i++)
            {
                int val = salt[i];

                for (int t = 3; t >= 0; t--)
                {
                    binaryPassword[t + offset] = (byte)(val % 256);
                    val >>= 8;                     /* Scroll 8 bits to get next part*/
                }

                offset += 4;
            }

            //SHA1 sha = new SHA1CryptoServiceProvider();
            SHA1Hash sha = new SHA1Hash();

            byte[] temp = new byte[8];
            Buffer.BlockCopy(binaryPassword, 0, temp, 0, 8);
            byte[] binaryHash = sha.ComputeHash(temp);

            byte[] scrambledBuff = new byte[20];
            XorScramble(seedBytes, 4, scrambledBuff, 0, binaryHash, 20);

            string scrambleString = System.Text.Encoding.Default.GetString(scrambledBuff, 0, scrambledBuff.Length).Substring(0, 8);

            long[] hashPass    = Hash(password);
            long[] hashMessage = Hash(scrambleString);

            long max = 0x3FFFFFFFL;

            byte[] to        = new byte[20];
            int    msgPos    = 0;
            int    msgLength = scrambleString.Length;
            int    toPos     = 0;
            long   seed1     = (hashPass[0] ^ hashMessage[0]) % max;
            long   seed2     = (hashPass[1] ^ hashMessage[1]) % max;

            while (msgPos++ < msgLength)
            {
                to[toPos++] = (byte)(Math.Floor(rand(ref seed1, ref seed2, max) * 31) + 64);
            }

            /* Make it harder to break */
            byte extra = (byte)(Math.Floor(rand(ref seed1, ref seed2, max) * 31));

            for (int i = 0; i < 8; i++)
            {
                to[i] ^= extra;
            }

            return(to);
        }
Exemplo n.º 26
0
 public bool LoadChunk(SHA1Hash id, long variantSize, long originalSize, Stream output)
 {
     return(this.LoadChunk(id, variantSize, originalSize, output, false));
 }