diff --git a/Base64Decode.cs b/Base64Decode.cs deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md index a160bba..502b4a9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Part One -``` Please decode the text below. Upon decoding, you will be taken to a URL with further instructions on completing the challenge. aHR0cHM6Ly90bnM0bHBnbXppaXlwbnh4emVsNXNzNW55dTBuZnRvbC5sYW1iZGEtdXJsLnVzLWVhc3QtMS5vbi5hd3MvcmFtcC1jaGFsbGVuZ2UtaW5zdHJ1Y3Rpb25zLw== + +```bash +dotnet script base64Decode.csx aHR0cHM6Ly90bnM0bHBnbXppaXlwbnh4emVsNXNzNW55dTBuZnRvbC5sYW1iZGEtdXJsLnVzLWVhc3QtMS5vbi5hd3MvcmFtcC1jaGFsbGVuZ2UtaW5zdHJ1Y3Rpb25zLw== ``` + +Running the above yielded: [https://tns4lpgmziiypnxxzel5ss5nyu0nftol.lambda-url.us-east-1.on.aws/ramp-challenge-instructions/](https://tns4lpgmziiypnxxzel5ss5nyu0nftol.lambda-url.us-east-1.on.aws/ramp-challenge-instructions/) + + diff --git a/base64Decode.csx b/base64Decode.csx new file mode 100644 index 0000000..9dec956 --- /dev/null +++ b/base64Decode.csx @@ -0,0 +1,23 @@ +#r "System" +#r "System.Text.Encoding" + +using System.Text; + +if (Args.Count == 0) +{ + Console.WriteLine("Usage: dotnet script base64Decode.csx "); + return; +} + +try +{ + string base64Encoded = Args[0]; + var base64Bytes = Convert.FromBase64String(base64Encoded); + var decodedString = Encoding.UTF8.GetString(base64Bytes); + + Console.WriteLine("Decoded String: " + decodedString); +} +catch (FormatException) +{ + Console.WriteLine("Invalid Base64 string!"); +} \ No newline at end of file