Это намного больше, но я думаю, что это выглядит немного более всесторонним: http://www.obviex.com/Samples/Password.aspx
///////////////////////////////////////////////////////////////////////////////
// SAMPLE: Generates random password, which complies with the strong password
// rules and does not contain ambiguous characters.
//
// To run this sample, create a new Visual C# project using the Console
// Application template and replace the contents of the Class1.cs file with
// the code below.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
//
// Copyright (C) 2004 Obviex(TM). All rights reserved.
//
using System;
using System.Security.Cryptography;
///
/// This class can generate random passwords, which do not include ambiguous
/// characters, such as I, l, and 1. The generated password will be made of
/// 7-bit ASCII symbols. Every four characters will include one lower case
/// character, one upper case character, one number, and one special symbol
/// (such as '%') in a random order. The password will always start with an
/// alpha-numeric character; it will not start with a special symbol (we do
/// this because some back-end systems do not like certain special
/// characters in the first position).
///
public class RandomPassword
{
// Define default min and max password lengths.
private static int DEFAULT_MIN_PASSWORD_LENGTH = 8;
private static int DEFAULT_MAX_PASSWORD_LENGTH = 10;
// Define supported password characters divided into groups.
// You can add (or remove) characters to (from) these groups.
private static string PASSWORD_CHARS_LCASE = "abcdefgijkmnopqrstwxyz";
private static string PASSWORD_CHARS_UCASE = "ABCDEFGHJKLMNPQRSTWXYZ";
private static string PASSWORD_CHARS_NUMERIC= "23456789";
private static string PASSWORD_CHARS_SPECIAL= "*$-+?_&=!%{}/";
///
/// Generates a random password.
///
///
/// Randomly generated password.
///
///
/// The length of the generated password will be determined at
/// random. It will be no shorter than the minimum default and
/// no longer than maximum default.
///
public static string Generate()
{
return Generate(DEFAULT_MIN_PASSWORD_LENGTH,
DEFAULT_MAX_PASSWORD_LENGTH);
}
///
/// Generates a random password of the exact length.
///
///
/// Exact password length.
///
///
/// Randomly generated password.
///
public static string Generate(int length)
{
return Generate(length, length);
}
///
/// Generates a random password.
///
///
/// Minimum password length.
///
///
/// Maximum password length.
///
///
/// Randomly generated password.
///
///
/// The length of the generated password will be determined at
/// random and it will fall with the range determined by the
/// function parameters.
///
public static string Generate(int minLength,
int maxLength)
{
// Make sure that input parameters are valid.
if (minLength <= 0 || maxLength <= 0 || minLength > maxLength)
return null;
// Create a local array containing supported password characters
// grouped by types. You can remove character groups from this
// array, but doing so will weaken the password strength.
char[][] charGroups = new char[][]
{
PASSWORD_CHARS_LCASE.ToCharArray(),
PASSWORD_CHARS_UCASE.ToCharArray(),
PASSWORD_CHARS_NUMERIC.ToCharArray(),
PASSWORD_CHARS_SPECIAL.ToCharArray()
};
// Use this array to track the number of unused characters in each
// character group.
int[] charsLeftInGroup = new int[charGroups.Length];
// Initially, all characters in each group are not used.
for (int i=0; i
/// Illustrates the use of the RandomPassword class.
///
public class RandomPasswordTest
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
// Print 100 randomly generated passwords (8-to-10 char long).
for (int i=0; i<100; i++)
Console.WriteLine(RandomPassword.Generate(8, 10));
}
}
//
// END OF FILE
///////////////////////////////////////////////////////////////////////////////
SQLite явно является частью Android:
http: // developer. android.com/reference/android/database/sqlite/SQLiteDatabase.html
Однако вам, возможно, придется создать свой собственный уровень абстракции (построитель запросов для простых запросов) или иным образом иметь дело с SQL.
Может быть http : //developer.android.com/reference/android/database/sqlite/SQLiteQueryBuilder.html - это то, что вам нужно?
Там также Неодатис и Перш (Lite).
Год назад я играл с Перстом и пришел к выводу, что оно того не стоит.
В конце концов, а) Android работает на довольно ограниченном устройстве с ~ 16 МБ кучи на приложение и б) Вы, заказчики, действительно оцените производительность и низкое энергопотребление.
Поэтому мой совет - использовать SQLite и рукописный SQL. Это совсем несложно, и оболочки, предоставляемые Android SDK, действительно хороши.
РЕДАКТИРОВАТЬ: В 2012 году рекомендуется использовать ORM-компонент DroidParts (это мой проект).
Try ActiveAndroid. Он бесплатный и с открытым исходным кодом (Apache Version 2.0).
С сайта:
ActiveAndroid - это ORM в стиле активной записи (объектно-реляционный mapper). [...] ActiveAndroid позволяет вам сохранять и извлекать записи базы данных SQLite без написания ни одного оператора SQL. Каждая запись базы данных аккуратно упакована в класс с такими методами, как save() и delete().
[...] Доступ к базе данных в Android, мягко говоря, хлопотный. ActiveAndroid позаботится обо всех настройках и сложностях, и все это с помощью всего нескольких простых шагов настройки.
Существует проект android-active-record, который обеспечивает абстракцию ActiveRecord для доступа к базе данных Android SQLite. Он доступен здесь: http://code.google.com/p/android-active-record
Это позволяет устранить большую часть стандартного кодирования при выполнении операций CRUD над объектами базы данных, а также сводит к минимуму усилия по созданию/поддержанию структура базы данных