Jump to content

Wikipedia:Reference desk/Archives/Computing/2013 March 2

From Wikipedia, the free encyclopedia
Computing desk
< March 1 << Feb | March | Apr >> March 3 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


March 2

[edit]

Why is the internet full of references to "UFD2" hashes?

[edit]

Lots of websites claim to offer to decrypt "UFD2" hashes, if you sign up for an account with them. What's more forums seem to be full of people asking if anyone can "decrypt this udf2 hash for me please?". The thing is, I can't find a single website that actually says anything about what a udf2 hash might be when it's at home. I'm starting to suspect they don't even exist. Can anyone shed any light? I do know what a hash is. —Noiratsi (talk) 13:29, 2 March 2013 (UTC)[reply]

It seems that Unique-F-Digest algorithm 2 (UFD2, not udf2) is a password hashing scheme (reminiscent of, but not built from, md5) used by some large websites. So people asking for a "decrypt" have obtained one of the large dumps of (username,hashedpw) data that have been released, and are looking for help brute-forcing a password that will hash to hashedpw, allowing them to log in to those accounts. I'm surprised that I can't find a reliable source describing the UFD2 scheme (which seems not to be SHA1 or MD5), only very dodgy sites selling software to brute-force them. Perhaps this is a script-kiddie nickname for PBKDF2? -- Finlay McWalterTalk 15:11, 2 March 2013 (UTC)[reply]
It's possible that there's no such thing as UFD2: that the purported dumps are fake and the online decrypter sites (which naturally want a credit card) are just a means of harvesting card details. It could even be a wheeze run by some law enforcement agency to trap particularly dumb script kiddies. -- Finlay McWalterTalk 15:32, 2 March 2013 (UTC)[reply]
Searching Google for "Unique-F-Digest" (with quotes) turns up nothing but a few copies of the identical description beginning "In cryptography, [...] is a widely-used cryptographic hash function with a 512-bit hash value..." (well, now it also turns up your reply). It's pretty obvious that no such algorithm exists. I assume this is a scam in which you enter a Facebook email address and the site responds with an alleged hash of that person's password, which you then have to buy their software to "decrypt". That would explain the various forum posts from people who urgently need a single UFD2 hash value decrypted. -- BenRG (talk) 19:24, 2 March 2013 (UTC)[reply]
How mysterious. If it is a scam, it looks to be impressively big and undocumented... Thank you both for your replies and sorry for my misspelling! —Noiratsi (talk) 09:48, 3 March 2013 (UTC)[reply]
I don't know if I'd agree it's impressively big. Sure there have been a bunch of people suckered but most of the search results are just junk spam links. I never posted but came to a similar conclusion to BenRG. In particular if you look for UFD2 there's zero discussion or mention of where it's used beyond obviously crap stuff like suggestions it's used on Facebook, Hotmail etc. I found something similar to BenRG which says it was adopted in 2009 and as BenRG mentioned, it says it's 512 bit but all the examples you see are not 512 bit. (There is similar bullshit about ever changing salts which they know from site admin contacts.) I had expected that the people would provide free 'hacking' 'tools' allegedly from a third party to help people recover these UFD2 'hashes' from Facebook/Hotmail etc and then these tools either recommend UFD2 'decrypters' or they let people find them themselves. But it seems BenRG is right, most of these sites provide the 'hash' to you if you enter a Facebook ID and email address to receive the 'hash' but then you have to buy their tool 'decrypt' it. It seems some even provide the help 'service' of premium accounts allowing you receive multiple 'hashes' without having to wait. I guess they figured providing tools is too complicated for their target market and if their marks didn't realise the whole thing is dodgy from the existing bullshit then providing 'hashes' via their website wouldn't seem any more dodgy. Nil Einne (talk) 16:15, 4 March 2013 (UTC)[reply]

Massively long source files

[edit]

I've got an Xcode project going, and I need to use the View Controller file a lot for things like data sources and so on. I was getting nervous about how long the file was becoming, and I was starting to break it up. I've now started realising how dreadfully pesky this is, with all sorts of #import statements all over the place, then having to work out how to access the different variables. I'm thinking of just having a mega-long View Controller file, which could end up as hundreds of lines of code. I've realised it isn't really that inconvenient, because you can use a bar at the top to navigate among the different functions, all with a couple of clicks. Is there any established thinking on practices like this, such as having very long files so long as you have the menu system for navigation within the file? Or is it just personal preference? IBE (talk) 18:10, 2 March 2013 (UTC)[reply]

"Hundreds of lines" doesn't seem like a problem to me. I prefer to have the main and subroutines/functions in the same physical file, if the total is under, say, 1000 lines. Above that I might keep each subroutine in a different file. This requires a more complex directory structure, though, especially if you want to keep and be able to restore to the old versions of each subroutine (you need logic like "main v9 goes with subroutine_a v7 and subroutine_b v10"). One particular limit is where moving the scroll bar 1 pixel moves the text more than a page, which seems to happen around 3000 lines, depending on various factors like the screen resolution, window size, font, etc. I find it also helps to have labels you can (control F) find at the start of each subroutine. For example, I might put "QAZ" at the start of each, knowing that string's not likely to come up elsewhere. This allows me to quickly jump between subroutines, rather than scrolling.
However, I do believe in keeping data separate from code (except for maybe a small amount of hard-coded data used for an early test case). So, data belongs in separate files. StuRat (talk) 18:21, 2 March 2013 (UTC)[reply]
Good answer - regarding "data sources", I am referring to the Xcode/ iOS concept, which not many people are familiar with. I didn't elaborate, because I didn't think it was important. For the record, I have a couple of files that are the real "data sources". Then I have a central file called the "View Controller". This is closest in spirit to the "main" function of C, since it instantiates and directs things. Then finally there is a file called the View, which presents things on the screen. The View has a "data source", which is actually a whole bunch of methods (functions) that interface with the various data files. Apple has just chosen to refer to the file that holds these methods as a "data source". It does not hold the actual data. An example method name might be "getNumberOfItemsInDataArray". This would be declared in the View, because the View **has a** data source, and defined in another file, the file which **is a** data source. If there are just a few of these methods, they usually go straight in the View Controller file, since that is central, and can "see" everything else. If I put it in a separate file, every individual file is nice and compact, but the lines of communication seem all over the place. The View file needs data loaded so it calls the Data Source methods, which are in the separate file, which connects up with the actual data files, and so on. So I like the sound of your solution. All the actual data will remain separate, so I think it will be right to keep it in one file. Any more suggestions/ advice welcome. IBE (talk) 18:48, 2 March 2013 (UTC)[reply]
If you're worried about things actually breaking, from a technological standpoint a few hundred lines is a trivial size. If you look at the size of the file that gets sent from the preprocessor to the compiler (or would, if the two were still separate programs), with all the headers from #include and #import inlined, the program stream expands to many thousands of lines (and many include more files in turn). I don't have ObjectiveC headers loaded, but of the C and C++ standard headers on my system, most are hundreds of lines and plenty are thousands. This was a real issue a couple of decades ago, when computer memories were small and virtual memory wasn't ubiquitous; I certainly had compiles fail because the program text grew, by dint of such includes, so big that it couldn't fit into memory. But those days are long gone. So the compiler will be okay, and it's just your sanity that's at stake - I don't know enough about Xcode/objc development to have anything worthwhile to say about what to do in that regard. -- Finlay McWalterTalk 18:55, 2 March 2013 (UTC)[reply]
Thankyou - I regard any general experience as relevant, largely because I trust that Xcode is typical enough as a development environment, for a general question like this. I just know people keep preaching about different standards/ rules that they think should be universal, such as having seven lines of code per function, designing every object based on a real world analogy and so on. As a neophyte, but with enough intelligence and general computing experience, I feel it would be wise to just get some feedback on general standards etc for something like this. I've done plenty of programming, but never anything of any scale, nor anything for commercial use. I have a 20mb web app, with some files in the 3000 line range, and that sucks, but gedit/ javascript doesn't do the same exciting things that Xcode does, like clicking to jump to a particular method. So my sanity is probably better with a long file; I just want to check there isn't some religious view that I'm transgressing. Not that I would necessarily die in my sin, just that I'd rather know what I might be up against. IBE (talk) 19:11, 2 March 2013 (UTC)[reply]
Lines of code are a poor metric of software complexity. Even if we only consider the same language, the density of lines to implement a task or feature varies wildly between application domains. For example, in C but using CoreFoundation, I may require four to eight lines to declare and initialize a variable. In ANSI C, or Objective C, or Java, this seems ridiculous, and I admit that it can seem unnecessarily verbose in some contexts. Yet, in other problem domains, when I want a CFNumber and I actually care about the details, I need that code to create it, set its value and type, check for allocation errors, and so on. Some developers pejoratively call this boilerplate code and prefer to use languages or features that abstract these details away. I appreciate their opinion and wish them the best luck writing their application software; but I cannot always write such coarse-granularity code. I write hardware drivers and kernel code; and every pedantic detail in these code lines matters - they are not identical "boilerplate" lines. If I find identical lines of code, I could macroize them. Or I can just learn to work in a different type of problem-domain, where each code line is more pedantic and less feature-dense. I can become better at reading such code line-by-line, and I can also let my development tools help me accomplish my task.
Knowing what my code looks like, If I arbitrarily imposed a limt of "seven lines per function," I couldn't get any work done at all in that function! Beware of generic rules of thumb or stylistic guidelines that purport to tell you "best practice." Best practices are domain-specific; they cannot be applied as iif all code does the same thing. If my code was meant to look and feel exactly like someone else's code, I'd be using their code. Some tasks are complex, and require many lines of code to define correct behavior in all cases. Real code that does actual work often does not look like textbook example code - it has complexity and non-idealities; and this says nothing of bugs and stylistic imperfections introduced in code that is written under time and information constraints. When you work in Xcode, you have the benefit of a powerful IDE to help navigate that complexity. Large files are not a problem if you use an IDE. Large files do not imply disorganized or malfunctioning code. Certain types of complexity cannot be abstracted or encapsulated. I would go so far as to say that "seven lines per function" qualifies as an antipattern; if your code is maintained by developers who require bite-sized functions, you may need new developers who are better able to cope with real-world complexity, or know how to use modern software tools.
And if you want a real-world example, have a look at Apple's open-source USB optical mouse power management source-code. An optical mouse - a device that is either plugged in, or not plugged in - either on, or off - requires several lines of code to properly implement power-management. If you think you can produce a mouse-driver that could replace that logic using simple seven-line functions, you could sure give it a shot! You could edit that file in vim and produce "simpler code." And you could compile it and run it on your mac, replacing the built-in mouse driver provided by Apple with the version you edited in vim and built yourself. (Isn't open-source software amazing?!) Alternatively, you could open the project in Xcode, and instead of editi the code to make functions shorter, .... you could let Xcode tell you whether your mouse is consuming too much power; and whether the mouse-driver is compatible with older versions of OS X; and so on. Lots of patterns and methods of software development might lead to "better code." But, making functions shorter is not the best way to make software that works better. Nimur (talk) 21:46, 2 March 2013 (UTC)[reply]
Thanks - I certainly needed some of those links. Yes, I know to take rules as just guidelines at best, but I like to read them all the same. There is no substitute for a competent programmer, and no language that can rescue anyone from an incompetent one. But for inexperienced programmers, it is good to know what people are teaching, since that is safer. They have presumably found their students make less mistakes under their guidance, so that is where they are coming from. I have learnt not to overdo the rules, but I treat them as something like compiler warnings. I can make them go away, but I like to see what needs at least some consideration. IBE (talk) 21:58, 2 March 2013 (UTC)[reply]
I think a purist would argue that every function/subroutine should be in a separate file, as that allows the maximum flexibility in swapping in and out certain versions of each functions. However, that just seems to add unnecessary complexity, in many cases, to me. One place where I would do that, though, is if I expected to reuse those functions in other programs. I will create a "Utility" directory, or sometimes several, in that case. For example, I might have "Utilities for Windows", "Utilities for Linux", and "Platform Independent Utilities". StuRat (talk) 22:05, 2 March 2013 (UTC)[reply]
Good idea - I might try that. Anyone can add more, and I will still read it, but that has given me plenty to go on. I don't put "resolved" on threads like this that naturally invite further comment, but I have decided to just have an elongated View Controller file, and save myself the mucking about. Thanks to all. IBE (talk) 23:05, 2 March 2013 (UTC)[reply]
You're quite welcome. StuRat (talk) 18:10, 6 March 2013 (UTC)[reply]

Why does Drupal come up when I try to access Wikifonia

[edit]

I am a fairly low key technology user (some would say bordering on ludite) and I am having difficulties trying to access a favourite website - Wikifonia. Whenever I try to get to Wikifonia a Drupal page pops up and it will not let me go any further.

It is getting very frustrating and any help getting through this would be greatly appreciated. — Preceding unsigned comment added by Kgranger06 (talkcontribs) 22:14, 2 March 2013 (UTC)[reply]

The error message suggests it's broken; it's their fault, not yours, so you'll have to wait until they fix it. -- Finlay McWalterTalk 22:18, 2 March 2013 (UTC)[reply]

Thank you. Was a bit concerned when they were asking me to install Drupal as it all seemed a bit out of my league. — Preceding unsigned comment added by Kgranger06 (talkcontribs) 23:07, 2 March 2013 (UTC)[reply]

Windows PowerShell scripting help

[edit]

I am running Windows 7 with Windows PowerShell 3.0 and I am trying to write a script that will follow this recursively list all files and folders with the present working directory according to this format (say that I am running this in C:\Users\Owner\Documents\):

Books\
Evaluation Project\
Evaluation Project\
Evaluation Project\Brainstorming.docx
Evaluation Project\Final.docx
Evaluation Project\Summary.docx
Visual Studio 2012\
Visual Studio 2012\Code Snippets\
Visual Studio 2012\Projects\
Visual Studio 2012\Settings\
Visual Studio 2012\StartPages\
Visual Studio 2012\Templates\
Comments.txt
VMDK.vmdk

Notice that folders have a backslash after them. I originally had this script but it doesn't do it the above way:

$PATH = "$PWD"
DIR $PATH -Recurse | % { 
	$D = "\"     
	$O = $_.FullName -Replace ([Regex]::Escape($PATH)+"\\"), ""
	if ( -Not $_.PSIsContainer) {
		$D = [String]::Empty
	}      
	"$O$D"
}

How can it be fixed? --Melab±1 22:22, 2 March 2013 (UTC)[reply]

Does this helps? 190.60.93.218 (talk) 19:24, 4 March 2013 (UTC)[reply]