Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post

I will be maintaining my libraries here:
https://bit.ly/pATDBi

I am the lead developer for libraries 
that ship with the Wiring distribution. 
As per version 1.0 -
Wiring will support Arduino boards.
You are welcome to check it out!
https://wiring.org.co/download/
Password Library for Arduino
Author:  Alexander Brevig
Contact: alexanderbrevig@gmail.com
Updates: Nathan@sobisource.com

Under Construction


Navigation


Current version

1.2 2012-04-05: Compile Fixes and Updates For Arduino IDE v1.0 <<


History

1.2 2012-04-05: Compile Fixes and Updates For Arduino IDE v1.0 <<
1.1 2009-06-17: Added assignment operator =, equality operators == != and insertion operator <<
1.0 2009-06-17: Initial Release


Description

Password is a library for the Arduino.

It is created to help simplify the handling of passwords.


Download, install and import

Download here: Password.zip

Put the Password folder in "hardware\libraries\".
In the Arduino IDE, create a new sketch (or open one) and select from the menubar "Sketch->Import Library->Password".
Once the library is imported, an '#include <Password.h>' line will appear at the top of your Sketch.


Creation

Password password = Password("P4ssword");


Functions

set(password)

Set the target password equal to password.

Warning: The new password should be a global variable (not a local function variable) as this function copies a pointer to the new password into the library, not a copy of the password.

is(password)

Is the target password equal to password

append(character)

Append a character to the currently guessed password

reset()

Reset the currently guessed password

evaluate()

Is the guessed password equal to the target password?


Example

  1. #include <Password.h>
  2.  
  3. Password password = Password( "1234" );
  4.  
  5. void setup(){
  6.   Serial.begin(9600);
  7.  
  8.   password.append('1');//add 1 to the guessed password
  9.   password.append('2');//add 2 to the guessed password
  10.   password.append('3');//add 3 to the guessed password
  11.   password.append('4');//add 4 to the guessed password
  12.   //should print true, since 1234 == 1234
  13.   Serial.println( password.evaluate()?"true":"false" );
  14.  
  15.   password.reset(); //reset the guessed password to NULL
  16.   //should print false, since 1234 != NULL
  17.   Serial.println( password.evaluate()?"true":"false" );
  18.  
  19.   password.set("qwerty"); //set target password to qwerty
  20.   //should print true, since qwerty == qwerty
  21.   Serial.println( password.is("qwerty")?"true":"false" );
  22.   //should print false, since qwerty != qwirty
  23.   Serial.println( password.is("qwirty")?"true":"false" );
  24. }
  25.  
  26. void loop(){/*nothing to loop*/}


FAQ

//contact me


Information about this page

Part of AlphaBeta Libraries.
Last Modified: November 16, 2013, at 03:14 PM
By: nickgammon