Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 28 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I have a very simple C# application that was written by a previous person. It uses the MD5CryptoServiceProvider to compute hash using some seed strings to generate a random code.
I have a Node.js server running that I'd like to execute this app and consume the output.
I cannot figure out how to run C# from Ubuntu and I cannot find an MD5 library that comes up with the same answer.
Here is the entirety of the function:
{ MD5 md5 = new MD5CryptoServiceProvider(); byte[] encodeBytes = System.Text.Encoding.UTF8.GetBytes(seed1+ seed2+ seed3); byte[] output = md5.ComputeHash(encodeBytes); string result = string.Format("{0:D}{1:D}{2:D}{3:D}{4:D}{5:D}", ((output[0] + output[1]) % 10), ((output[2] + output[3] + output[4]) % 10), ((output[5] + output[6]) % 10), ((output[7] + output[8] + output[9]) % 10), ((output[10] + output[11] + output[12]) % 10), ((output[13] + output[14] + output[15]) % 10)); return result; }
Is it possible for me to modify this C# script to run as a child process or get the same answer using a C++ script, which I have gotten to run with a Node server previously.
Thank you!!
You should just convert your code to Javascript:
function generateCode() { let seed1 = 'abc'; let seed2 = 'def'; let seed3 = 'ghi'; let hashed = md5(seed1 + seed2 + seed3); let values = []; for (let i = 0; i < hashed.length; i += 2) { values.push(parseInt('0x' + hashed.substr(i, 2))); } let codeParts = [((values[0] + values[1]) % 10), ((values[2] + values[3] + values[4]) % 10),((values[5] + values[6]) % 10), ((values[7] + values[8] + values[9]) % 10),((values[10] + values[11] + values[12]) % 10), ((values[13] + values[14] + values[15]) % 10)]; let code = codeParts.join(''); alert(code); } generateCode();
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.