private static void GenerateAndProcessKeys() { Guid guid = Guid.NewGuid(); string input = string.Empty; string hash = string.Empty; string base64encodedHash = string.Empty; Console.WriteLine("Enter a string to use as the base for the key: "); input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { Console.WriteLine("You have note entered a string, a GUID will be generated and used. \n\n"); input = guid.ToString(); } hash = GenerationUtilities.ComputeSha256Hash(input); base64encodedHash = GenerationUtilities.Base64Encode(hash); Console.WriteLine($"Sub id format: {input.Replace("-", "")}"); Console.WriteLine($"Base input: {input}"); Console.WriteLine($"Hashed input: {hash}"); Console.WriteLine($"Base64 encoded hash: {base64encodedHash}"); }
internal virtual void GetFinishers(int worldX, int worldZ, ushort chunkX, ushort chunkZ, int height, ref ushort[,,] voxels) { if (structureSpawns != null) { foreach (StructureSpawn structureSpawn in structureSpawns) { if (GenerationUtilities.White(worldX, worldZ, 1, 1, structureSpawn.NoiseOffset.x, structureSpawn.NoiseOffset.y) < structureSpawn.Chance) { for (ushort x = 0; x < structureSpawn.Structure.Dimension.x; x++) { for (ushort y = 0; y < structureSpawn.Structure.Dimension.y; y++) { for (ushort z = 0; z < structureSpawn.Structure.Dimension.z; z++) { if (structureSpawn.Structure.Voxels[x, y, z] != 0 && Chunk.InChunk(chunkX + x + structureSpawn.Structure.Origin.x, height + y + structureSpawn.Structure.Origin.y, chunkZ + z + structureSpawn.Structure.Origin.z)) { voxels[chunkX + x + structureSpawn.Structure.Origin.x, height + y + structureSpawn.Structure.Origin.y, chunkZ + z + structureSpawn.Structure.Origin.z] = structureSpawn.Structure.Voxels[x, y, z]; } } } } } } } }
private static void ControlLogic(int length, bool?includeSymbols) { string symbolsReply = ""; if (length == 0) { Console.WriteLine($"\n\nEnter a length for your password: "******"\n\nInvalid number entered. Enter a length for your password: "******"\n\nDo you want to include symbols in your password? (y/n)"); symbolsReply = Console.ReadLine(); while (!symbolsReply.Equals("y") && symbolsReply.Equals("Y") && !symbolsReply.Equals("n") && !symbolsReply.Equals("y") && !symbolsReply.Equals("")) { Console.WriteLine("\n\nInvalid response, answer (y/n):"); } includeSymbols = symbolsReply.Equals("y") || symbolsReply.Equals("Y"); if (includeSymbols == null) { includeSymbols = false; } } //set minimum length to 8 length = length < 8 ? 8 : length; Console.WriteLine($"\n\nYour password is: \n\n{GenerationUtilities.GeneratePassword(length, (bool)includeSymbols)}"); string controlResponse = "y"; Console.WriteLine($"\n\nDo you want to generate another password or the (s)ame password? (y/n/s)"); controlResponse = Console.ReadLine(); if (controlResponse == "y") { ControlLogic(0, null); } else if (controlResponse == "s") { ControlLogic(length, includeSymbols); } else { Console.WriteLine("Reply not 'y', exiting"); } }
public StructureSpawn(Structure structure, Spawn spawn) { Structure = structure; Chance = spawn.Chance; int nameHashCode = structure.Name.GetHashCode(); int voxelSize = structure.Voxels.GetLength(0) + structure.Voxels.GetLength(1) + structure.Voxels.GetLength(2); NoiseOffset = new Vector2i((int)(GenerationUtilities.White(nameHashCode, voxelSize) * nameHashCode * 0.00001), (int)(-GenerationUtilities.White(nameHashCode / 10, -voxelSize) * structure.Name.Length * voxelSize * nameHashCode.ToString().Length * 5)); }
public static Region GetRegion(int worldX, int worldZ) { if (GenerationUtilities.Cellular(worldX, worldZ, 0.6f, 1.4f) > 0.5f) { return(RegionReferences.Greenlands); } else { return(RegionReferences.Desert); } }
public void SetupLetter(int level, Destination dest, bool isBomb, Language lang) { this.levelCreated = level; this.isBomb = isBomb; this.dest = dest; GetComponentInChildren <Text>().text = GenerationUtilities.GenerateName(lang) + "\n" + GenerationUtilities.GenerateAddress(lang) + "\n" + GenerationUtilities.GenerateDestName(lang, dest); itemInfo = "Drop this letter into the correct box."; }
private static void ControlLogic() { string controlResponse = "y"; while (controlResponse == "y") { Console.WriteLine($"\n\nDo you want to generate another sub id? (y/n)"); controlResponse = Console.ReadLine(); if (controlResponse == "y") { GenerationUtilities.GenerateSubId(); } else { Console.WriteLine("Reply not 'y', exiting"); } } }