TerryDev
TerryDev
CC#
Created by TerryDev on 1/30/2024 in #help
MudBlazor Generic Server Side Table Issues
I forgot to mention, this is running .NET 7
4 replies
CC#
Created by Zerraq on 1/30/2024 in #help
.NET Core & React | Authentication
https://github.com/msuddaby/ASPNetCoreJWTAuthTemplate heres a stock template (I made) for ASP.NET Core Web API with JWT auth. there's plenty of ways to handle auth in react, here's an example of storing / fetching auth stuff with useContext: https://gist.github.com/msuddaby/76b7b68ba60565b82cabd7b904b4cabb hopefully this is enough to help you get started.
17 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
time to ditch drupal forever hahah
35 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
thank you so much for your help!
35 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
oh my god yup that did it
35 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
Wait does c# have the =| operator?
35 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
Hmmmm
35 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
ord() function is a inbuilt function in PHP that returns the ASCII value of the first character of a string
35 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
Yup I’ve successfully written the password hashing function in C#, and verified that it’s hashing the passwords correctly. The last piece of the puzzle is converting the hash byte array to the weird string it stores in the database
35 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
Ah yes the classic “just use something else” hahahah
35 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
Perhaps the comment at the top of the PHP function above might ring some bells for you? I’m completely lost when it comes to this stuff unfortunately. I appreciate your help
35 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
Drupal fucking sucks, which is why I’m trying to move away from it and just build everything from scratch haha
35 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
I’ve attempted to use that, however whatever weird function drupal uses to hash it’s passwords outputs something completely different from a regular base64 conversion. Using Convert.ToBase64 and phps built in Base64 encoder produce the exact same string on the input, but unfortunately I need the C# program to output the Base64 string that’s encoded through this method
35 replies
CC#
Created by TerryDev on 12/11/2022 in #help
✅ Need some help converting PHP code to CS
just in case, here is the original PHP function in full:
function _password_itoa64() {
return './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
}

/**
* Encodes bytes into printable base 64 using the *nix standard from crypt().
*
* @param $input
* The string containing bytes to encode.
* @param $count
* The number of characters (bytes) to encode.
*
* @return
* Encoded string
*/
function _password_base64_encode($input, $count) {
$output = '';
$i = 0;
$itoa64 = _password_itoa64();
do {
$value = ord($input[$i++]);
$output .= $itoa64[$value & 0x3f];
if ($i < $count) {
$value |= ord($input[$i]) << 8;
}
$output .= $itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count) {
break;
}
if ($i < $count) {
$value |= ord($input[$i]) << 16;
}
$output .= $itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count) {
break;
}
$output .= $itoa64[($value >> 18) & 0x3f];
} while ($i < $count);

return $output;
}
function _password_itoa64() {
return './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
}

/**
* Encodes bytes into printable base 64 using the *nix standard from crypt().
*
* @param $input
* The string containing bytes to encode.
* @param $count
* The number of characters (bytes) to encode.
*
* @return
* Encoded string
*/
function _password_base64_encode($input, $count) {
$output = '';
$i = 0;
$itoa64 = _password_itoa64();
do {
$value = ord($input[$i++]);
$output .= $itoa64[$value & 0x3f];
if ($i < $count) {
$value |= ord($input[$i]) << 8;
}
$output .= $itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count) {
break;
}
if ($i < $count) {
$value |= ord($input[$i]) << 16;
}
$output .= $itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count) {
break;
}
$output .= $itoa64[($value >> 18) & 0x3f];
} while ($i < $count);

return $output;
}
35 replies