Template function written for finding multimap intersectionof written one part of string as pointer and rest correctly
Date : March 29 2020, 07:55 AM
Hope that helps I have written a code for finding intersection of two multimap which will compare values related to key and fetch us a map containing a comman elements (combination of key and value) from two map. This is displaying one part of string as pointer and rest as usual. , From your code: cout << "first common element is : " <<
cout << it2->first << " " << it2->second <<" " << endl;
^^^^
|
I've my function written correctly at least I think it is but it appears it doesn't work
Tag : php , By : Pradeep Gowda
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further output every variable. make code as comment. check if your code works without loggedin() and so on. Check every code line and find the error. Learn to find errors :D good work )) AND CHECK THE php.ini FILE ERROR_REPORTING if no error is shown.
|
parse error on input ‘::’ when making an explicit type definition for a function which accepts multiple arguments
Date : March 29 2020, 07:55 AM
this will help type is a keyword in Haskell, so you can't use it as the name of your function. Furthermore type names start with a capital letter in Haskell and anything starting with a lower case letter in a type is a type variable. So if you define myFunction :: validChars -> tuple -> tuple, that defines a function that takes two arguments of arbitrary types and produces a result of the same type as the second argument. It's the same as myFunction :: a -> b -> b.
|
Self written HMAC function, not working correctly
Tag : cpp , By : user147496
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further Ok..so a little look around lead me to HMAC produces wrong results. Turns out, I was doing the same mistake of using hex as ascii. I used a function to convert the inner_hash from hex to ascii and then everything turned out perfect. std::string HMAC::getHMAC(const std::string &text)
{
// check if key length is block_size
// else, append 0x00 till the length of new key is block_size
int key_length = key.length();
std::string newkey = key;
if (key_length < block_size)
{
int appended_zeros = block_size - key_length;
// create new string with appended_zeros number of zeros
std::cout << "\nAppending " << appended_zeros << " 0s to key";
std::string zeros = std::string(appended_zeros, 0);
newkey = key + zeros;
}
if (key_length > block_size)
{
SHA1 sha1;
newkey = sha1(key);
}
// calculate hash of newkey XOR ipad and newkey XOR opad
std::string keyXipad = newkey;
std::string keyXopad = newkey;
for (int i = 0; i < 64; i++)
{
keyXipad[i] ^= ipadVal;
keyXopad[i] ^= opadVal;
}
// get first hash, hash of keyXipad+text
std::string toInnerHash = keyXipad + text;
std::string inner_hash = getHash(toInnerHash);
// get outer hash, hash of keyXopad+inner_hash
std::string toOuterHash = keyXopad + hex_to_string(inner_hash);
std::string outer_hash = getHash(toOuterHash);
// return outer_hash
return outer_hash;
}
|
Javascript Palindrome function logic written correctly?
Date : March 29 2020, 07:55 AM
To fix the issue you can do I'm new to programming so please bear with me. I'm currently working on Functions Logic. I'm trying to write a function to see if the string passed is a palindrome or not (true or false). , It can be simplified as: function palindrome(word) {
return word === Array.from(word).reverse().join('')
}
console.log(palindrome("ohho"))
console.log(palindrome("ohno"))
function palindrome(word) {
var ln = word.length;
for (var i = 0; i <= ln/2;)
if (word[i++] !== word[ln-i]) return false;
return true
}
console.log(palindrome("ohho"))
console.log(palindrome("ohno"))
|