It is currently April 19th, 2024, 6:13 pm

Replacing all characters in string with *

Get help with creating, editing & fixing problems with skins
zdzihu
Posts: 9
Joined: October 10th, 2014, 7:44 am

Replacing all characters in string with *

Post by zdzihu »

Long time no see / heard. I'm working on a kind of password manager which would allow me to store a password and display it in 2 ways - one being masked by replacing all characters with * signs and one in totally normal way, like this:


1. default
*******************

2. visible on hover
MyPassword1234#YOLO


I've been playing with the Substitute examples in the manual (http://docs.rainmeter.net/manual/measures/general-options/substitute) but I didn't manage to get working.


Any help would be appreciated.
Last edited by zdzihu on February 22nd, 2015, 10:09 am, edited 1 time in total.
This is the single least-secure password manager I have ever seen... ;-)
http://rainmeter.net/forum/viewtopic.php?f=5&t=20424&p=109151#p109151
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Replacing all characters in string with *

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
PassSubst="(?s).":"×"
Pass1=MyPassword1234#YOLO

[MeasurePass1]
Measure=String
String=#Pass1#
RegExpSubstitute=1
Substitute=#PassSubst#

[MeterPass1]
Meter=String
MeasureName=MeasurePass1
W=200
H=16
X=100
StringAlign=Center
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
MouseOverAction=[!SetOption MeasurePass1 Substitute ""][!UpdateMeasure MeasurePass1][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption MeasurePass1 Substitute """#PassSubst#"""][!UpdateMeasure MeasurePass1][!UpdateMeter *][!Redraw]
test.gif
Note that you will pretty much always need to use the """ magic quotes when you set a Substitute in a bang, due to the required and embedded quotes in the Substitute.

I used a Unicode character, as it vertically centers better than a plain ol "*", but remember that if you want to use that, or any other Unicode character, you will first need to encode your .ini file as UTF-16 Little Endian. If you want, there are a lot of nice symbols you can use here: http://copypastecharacter.com/all-characters.

Whatever symbol you use, you are likely to want to set a fixed width for the meter, as with variable width fonts it will act really strange when it replaces the string made up of various characters of various lengths with a single character that will then be "fixed" in length. You can get everything from just slightly ugly "jumpy" behavior, to really ugly problems with MouseOver/MouseLeave as the size of the meter changes.

This is the single least-secure password manager I have ever seen... ;-)
You do not have the required permissions to view the files attached to this post.
zdzihu
Posts: 9
Joined: October 10th, 2014, 7:44 am

Re: Replacing all characters in string with *

Post by zdzihu »

Thanks for the reply. This is what I've wanted to know. I tried to experiment with (.*) or (?siU) thingies like in common RSS readers but that didn't allow me to catch each single character. Looks like I need to dig into RegExp a little bit more. Still, consider my question solved.


About the magic quotes - I didn't plan to use them, instead was thinking of making 2 meters, and showing/hiding them on hover, but I'll take a closer look into your method as well.


Also, thanks about informing me about the encoding issue. I used the * sign as an example since most passwords are masked this way, but any other symbol will do.


About the security - hey, still better than having 20+ stickies around your screen. I don't share my PC with anybody, nor use it in public places. I just wanted to have all my passwords in 1 place with a nice hover effect because why not.


Last thing: if you don't mind, I'd like to put the last sentence of your post into my sig as a quote. I think not everyone around here get's such a "praise" from guru of RM.
This is the single least-secure password manager I have ever seen... ;-)
http://rainmeter.net/forum/viewtopic.php?f=5&t=20424&p=109151#p109151
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Replacing all characters in string with *

Post by jsmorley »

Sounds good. Two meters and hide / show would work fine, I tend not to do that when I can, as something about it seems "wasteful" compared to just "changing" one, but really in this case there is little difference. With hide / show of two meters, you wouldn't need the String measures, so it's really a wash. The only tiny advantage is that this way you don't have to "count" the characters in your password to have a matching number of symbols.

As to the symbol, an asterisk just seems boring somehow... If you can't use or something fun, then why get up in the morning?