-
Feature Articles
- Most Recent Articles
- The Easy No
- Flushed Out
- The Hot Fix
- The Roadmap
- Let's Be Facebook!
- Whales Ahoy!
- Three Digit Acronyms
- The Pride Goeth
- CodeSOD
-
Error'd
- Most Recent Articles
- Princess Pricing
- Einfach so
- Kaids Hen 2025
- Fi fa foe
- Microbits
- No Rush
- Bridge for Sale
- Super SEO Strategies
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
No, I wouldn't, actually. I'd assume that it's a callback that handles (the result of) the generation of the key, so we pass it as a callback (mechanism depending on the language) to some generator function.
Admin
Same here. If I wanted a key generated I'd expect something like GenerateRSAPrivateKey or RSAPrivateKeyGenerator.Generate or PrivateKeyGenerator.GenerateRSA etc.
Admin
I am dead certain that, when originally written, the function generated only RSA keys. Then somebody, for the exact reasons you mentioned, decided it needed to give the user a choice of algorithms. "Add in a parameter where you specify the algorithm. No, don't change the name, it'd be too much trouble tracking down everywhere it's referred to."
Admin
It would depend on what class/file it's in. If it's in a class named something like
PrivateKeyGenerator, sure, you would probably expect it to be called after the key is generated. If it's in a class of HTTP request handlers, then you would expect it to be the method that's called when the user sends aRSAPrivateKeyGenerationrequest, which I would guess is a request to generate a key (though as mentioned, something likeGenerateRSAPrivateKeywould be a better name).Admin
So the lesson here: avoid the generic "handle" in your method names, and pick a more descriptive verb. How is your method handling the thing?
Admin
I make sure as many of my methods as possible are named
HandleThing. That way, if the handling behaviour or thing type change I don't need to update the method name. This is what is known as self documenting codeAdmin
Honestly, I think the issue here is slightly different than what Remy suggests. Still not great, and perhaps I'm being a bit pedantic here. However, I think that in a lot of minds, "RSA key" has become a generic trademark for any sort of public/private key, similar to Kleenex for facial tissue, Jell-o for flavored gelatin, etc., and I think that's what's going on here. Not sure if it makes it slightly less of a WTF or not, though.
Admin
What about
get_words_from_a_number_which_is_passed_as_a_perimeter_into_this_function.Admin
It's weird, because those are both thoroughly American cultural references, and yet my British "raised in" makes me reject "Jell-o" as a genericised trademark, while totally accepting "Kleenex", although I wouldn't include the word "facial" in my definition.
Well, anyway, as I said, it's weird.
Admin
because perimeters are shapes, not numbers.
Admin
Yes, same goes for "util" and "helper".
Admin
Given the 'value = "algorithm", defaultValue = "EC"', my guess is that this RSA-key-generation function is generating an ECDSA key by default.
My follow-on guess, given the confusion shown in just this one line of code, is that the rest of the inevitably homebrew crypto operations they'll be using are no more secure. ECDSA use in particular is extremely easy to get wrong.
Admin
So it's a factory method not named create?
That's a rare sight, so my guess is that it once was some sort of mutator and the refactoring didn't include the name...
Admin
needsMoreCamelCase.
Admin
OUR JOURNEY TO A LIFE CHANGING LOTTERY WIN: My name is Richard Nuttall, my wife Debbie Nuttall and I are both 54 years old. WE ARE GLAD TO ANNOUNCE TO THE WORLD THAT WE WON £61,708,321 EUROMILLIONS JACKPOT PRIZE, with the number a lottery spell caster called Lord Bubuza gave us after casting his lottery spell. This man is a great seer and he is like a God on Earth that has turned our financial status for better. He was recommended to us by a friend in my office who he helped win the lottery, and as a couple, we discussed and decided to give his spell a try. We provided his requirement to cast the lottery spell and we are £61M richer today. We have made a vow to ourselves that we will keep testifying about him. We were sceptical at first, but no protection is risky, so we tried it and we are financially stable now. Join us to appreciate this genius. Do you want to win like us? Do you need your Ex back? Contact lord Bubuza because he is a miracle worker. His email: [email protected] / WhatsApp: +1 (365) 808 5313
Admin
And that's not considered a WTF? A private key is transmitted across the internet and displayed on a web page?