![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | comparing secure strings... i want to compare 2 user inputted secure strings $strA = read-host -assecurestring "Enter String" $strB = read-host -assecurestring "Re-Enter String" if ($strA -eq $strB) { write-host "Strings Match" } else { write-host "Strings do NOT match" } but...the problem is that it seems to always return false =( any suggestions? |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: comparing secure strings... You can convert the secure strings to plain text and do the comparison: $strA = read-host -assecurestring "Enter String" $strB = read-host -assecurestring "Re-Enter String" $tmpA = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($strA)) $tmpB = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($strB)) $tmpA -eq $tmpB ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com
| ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) |
| Guest | RE: comparing secure strings... I have the same question. I don't want to convert the SecureString back into text as this defeats the purpose of the SecureString. Can this be accomplished without using ConvertFrom-SecureString ? |
My System Specs![]() |
| | #4 (permalink) | ||||||||||||
| Guest | Re: comparing secure strings... On Apr 2, 4:04*pm, David Marvin <DavidMar...@xxxxxx> wrote:
strings without decrypting them also defeats the purpose ;-) function crack-password ($secureString) { $words = get-content dictionary.txt foreach ($word in $words) { $crypted = ConvertTo-SecureString $word if ($crypted -eq $secureString) { write-host "Password is $word" break; } } } Of course, this imaginary function will NOT work. Hope this clears things up, :-) - Oisin PowerShell MVP http://www.nivot.org/ | ||||||||||||
My System Specs![]() | |||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Comparing two lists | KeithK | PowerShell | 4 | 07-09-2008 05:27 PM |
| comparing hashtable values | Cookiecutter | PowerShell | 4 | 05-20-2008 10:36 AM |
| Comparing strings - is it a bug? | Tibor Soos | PowerShell | 7 | 03-13-2008 08:04 PM |
| Comparing filenames to strings | Tim | PowerShell | 17 | 08-24-2007 10:34 AM |
| secure and non secure items message | tim | Vista security | 3 | 07-21-2007 09:12 AM |