Short answer: sadly, there is no library to do what you want. I've done it myself numerous times but always in non open-source projects. I'm considering putting something up on github but I'm not sure when I can.
- Compiler is free to use dynamic word-size expression evaluation. C propagates to int. Your byte mask/shift can be done faster/smaller.
- Templatizing operations lets you vary word size and other properties, with type-safety.
The most common reason that Arduino shields "conflict" is because the Chip Select pin for an SPI on the shield is hardwired on the shield. Sometimes this is manifest in an accompanying software library for the shield that assumes the shield's wiring. A forgiving reason things end up this way is a tradeoff between elegance of the software and ease of use for the end user.
If you are optimizing flexibility, you will design your software to have the (potentially conflicting) pin assignments abstracted into a constructor or setter function, and make the default constructor make default assumptions about your hardware. You would also need to provide a jumper on your shield that you can shunt for "default" behavior or wire wherever to any of the I/O pins with a "soft" wire.
If every shield followed that practice, then there would not be such thing as conflicting shields. The drawback of the flexibility is that the more interfaces are exposed to users the higher the barrier to entry for beginners. I don't think anyone would argue that beginners are the majority of Arduino users, and so ease of use wins the day - fewer options and simplicity are better in most cases for the Arduino community.
A good example of a library and a shield that do it the "elegant" way are the LiquidCrystal library that comes standard with Arduino. There are five pins on the LCD interface that are software definable. I made a Basic LCD shield and had to make these kinds of choices in the design. I decided to favor flexibility because (1) the library already supported it, and (2) LCDs themselves are not consistent in their pinout. So I provided a whole bank of jumpers effectively "abstracting" the LCD from the shield in hardware. Maybe that wasn't the right choice in retrospect, but the spirit of my decision was to support whatever LCD you might want to use and whichever Arduino pins you might want to use.
If I had hard wired for certain Arduino pins and a particular LCD pinout, I could have saved users a few minutes of soldering, at the expense of flexibility and interoperability with other shields. In my case though, I saw the LCD shield as something that might be at "the top" of a shield stack, so maybe the flexibility was meritted in this case. There simply isn't a one-size fits all answer I'm afraid.
You don't want to encrypt passwords (PINs) -- you want to hash them. When someone enters a password, you hash that password, and compare the hash against the stored hash. The advantage to this method (used for over 30 years) is that even if someone gets hold of the source and the hashes, they still can't tell what PINs match the hashes, as long as you choose a strong enough hash function.
You don't want to implement encryption yourself -- you want to use someone else's library, particularly one with an open implementation that has been tested by a large community. Encryption is hard, testing is hard, and testing encryption is damned hard, so get someone else to do it for you.
You should checkout the AVR Crypto Library, which is licensed with GPLv3. There's also an implementation of Skein for AVR.