Beispiel #1
0
        private static void FillMemoryBlocks(Argon2Ctx ctx)
        {
            int np = (int)ctx.Lanes;

            Argon2ThreadInfo[] v = new Argon2ThreadInfo[np];

            for (ulong r = 0; r < ctx.TCost; ++r)
            {
                for (ulong s = 0; s < NbSyncPoints; ++s)
                {
                    for (int l = 0; l < np; ++l)
                    {
                        Argon2ThreadInfo ti = new Argon2ThreadInfo();
                        ti.Context = ctx;

                        ti.Pass  = r;
                        ti.Lane  = (ulong)l;
                        ti.Slice = s;

                        if (!ThreadUtil.Schedule(FillSegmentThr, ti))
                        {
                            Debug.Assert(false);
                            throw new OutOfMemoryException();
                        }

                        v[l] = ti;
                    }

                    for (int l = 0; l < np; ++l)
                    {
                        v[l].Finished.WaitOne();
                        v[l].Release();
                    }
                }
            }
        }