SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
koyama@hoge.org




                  1
about me


id:koyhoge



2007     OSS




                        2
agenda


id   generate

     encode/decode




                     3
RFC4648

The Base16, Base32, and Base64 Data
Encodings

Base 64 Encoding with URL and Filename
Safe Alphabet

          base64url

  + → -, / → _



                                         4
id        generate
DB    Sequence   id




     1 → NWoZK3kTsExUV00Ywo1G5jlU

     2 → 2kuSN7rMzfGcB2DKt67EqDWQ

                                    5
static public function genUniqHash($input, $options = null) {
    $seed = array_val($options, 'seed', 0);
    $length = array_val($options, 'length', 18); / 18 = non-padding max
                                                  /

    static $search = array('+', '/');
    static $replace = array('-', '_');

    / limit check: sha1() returns 20 bytes
     /
    if (($length <= 0) || (20 < $length)) {
         $length = 20;
    }
    if (($seed + $length) > 20) {
         $seed = 20 - $length;
    }

    $out = base64_encode(substr(sha1($input, true), $seed, $length));
    return str_replace($search, $replace, $out);
}



                                                                          6
encode/decode




gzip   +base64url




                            7
static public function tinyEncode($input) {
    static $search = array('+', '/');
    static $replace = array('-', '_');

    $gzed = gzdeflate($input);
    $encoded = base64_encode($gzed);
    $result = str_replace($search, $replace, $encoded);
    / trim trailing '='
     /
    return rtrim($result, '=');
}




                                                          8
static public function tinyDecode($encoded) {
    static $search = array('-', '_');
    static $replace = array('+', '/');
    $str = str_replace($search, $replace, $encoded);

    $decoded = base64_decode($str);
    return gzinflate($decoded);
}




                                                       9
Thanks for hearing




                     10

Contenu connexe

Tendances

San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Groupkchodorow
 
Pm 4.0 permission_storage
Pm 4.0 permission_storagePm 4.0 permission_storage
Pm 4.0 permission_storageOleg K
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionIan Barber
 
Teaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersTeaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersIan Barber
 
13. CodeIgniter vederea inregistrarilor3
13. CodeIgniter vederea inregistrarilor313. CodeIgniter vederea inregistrarilor3
13. CodeIgniter vederea inregistrarilor3Razvan Raducanu, PhD
 
Cache'owanie danych w PHP
Cache'owanie danych w PHPCache'owanie danych w PHP
Cache'owanie danych w PHPPatryk Jar
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)Night Sailer
 
20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked aboutTatsuhiko Miyagawa
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsPierre MARTIN
 
ネイティブ開発アンチパターン
ネイティブ開発アンチパターンネイティブ開発アンチパターン
ネイティブ開発アンチパターンYuki Tamura
 
MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤Takahiro Inoue
 
How to stand on the shoulders of giants
How to stand on the shoulders of giantsHow to stand on the shoulders of giants
How to stand on the shoulders of giantsIan Barber
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency InjectionRifat Nabi
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2Takahiro Inoue
 

Tendances (20)

San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
Pm 4.0 permission_storage
Pm 4.0 permission_storagePm 4.0 permission_storage
Pm 4.0 permission_storage
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
 
Teaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersTeaching Your Machine To Find Fraudsters
Teaching Your Machine To Find Fraudsters
 
13. CodeIgniter vederea inregistrarilor3
13. CodeIgniter vederea inregistrarilor313. CodeIgniter vederea inregistrarilor3
13. CodeIgniter vederea inregistrarilor3
 
Vcs28
Vcs28Vcs28
Vcs28
 
php plus mysql
php plus mysqlphp plus mysql
php plus mysql
 
Cache'owanie danych w PHP
Cache'owanie danych w PHPCache'owanie danych w PHP
Cache'owanie danych w PHP
 
Smelling your code
Smelling your codeSmelling your code
Smelling your code
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 
20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked about
 
wget.pl
wget.plwget.pl
wget.pl
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP Applications
 
Klug pgsql tut
Klug pgsql tutKlug pgsql tut
Klug pgsql tut
 
ネイティブ開発アンチパターン
ネイティブ開発アンチパターンネイティブ開発アンチパターン
ネイティブ開発アンチパターン
 
MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤
 
How to stand on the shoulders of giants
How to stand on the shoulders of giantsHow to stand on the shoulders of giants
How to stand on the shoulders of giants
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
TDDBC お題
TDDBC お題TDDBC お題
TDDBC お題
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2
 

En vedette

まつりとTシャツと私
まつりとTシャツと私まつりとTシャツと私
まつりとTシャツと私Tetsuji Koyama
 
FuelPHPを3ヶ月使ってみて
FuelPHPを3ヶ月使ってみてFuelPHPを3ヶ月使ってみて
FuelPHPを3ヶ月使ってみてTetsuji Koyama
 
日本は世界一のITコミュニティ天国
日本は世界一のITコミュニティ天国日本は世界一のITコミュニティ天国
日本は世界一のITコミュニティ天国Tetsuji Koyama
 
the History of LL events
the History of LL eventsthe History of LL events
the History of LL eventsTetsuji Koyama
 
Keires_DBリリースのご案内
Keires_DBリリースのご案内Keires_DBリリースのご案内
Keires_DBリリースのご案内Tetsuji Koyama
 
PHPプログラミングのIPv6対応の実際
PHPプログラミングのIPv6対応の実際PHPプログラミングのIPv6対応の実際
PHPプログラミングのIPv6対応の実際Tetsuji Koyama
 
The Widgetization Of Media by Futurist Gerd Leonhard (MIPCOM 2008)
The Widgetization Of Media by Futurist Gerd Leonhard (MIPCOM 2008)The Widgetization Of Media by Futurist Gerd Leonhard (MIPCOM 2008)
The Widgetization Of Media by Futurist Gerd Leonhard (MIPCOM 2008)Gerd Leonhard
 
LLまつりに行こう!
LLまつりに行こう!LLまつりに行こう!
LLまつりに行こう!Tetsuji Koyama
 
PHP Frameworks with IPv6
PHP Frameworks with IPv6PHP Frameworks with IPv6
PHP Frameworks with IPv6Tetsuji Koyama
 
開発ライセンスとプログラマーの自由
開発ライセンスとプログラマーの自由開発ライセンスとプログラマーの自由
開発ライセンスとプログラマーの自由Tetsuji Koyama
 
PHPで使うIPv6の実際
PHPで使うIPv6の実際PHPで使うIPv6の実際
PHPで使うIPv6の実際Tetsuji Koyama
 
the Histrory of LT and ドラ娘
the Histrory of LT and ドラ娘the Histrory of LT and ドラ娘
the Histrory of LT and ドラ娘Tetsuji Koyama
 

En vedette (17)

Sxedia
SxediaSxedia
Sxedia
 
まつりとTシャツと私
まつりとTシャツと私まつりとTシャツと私
まつりとTシャツと私
 
FuelPHPを3ヶ月使ってみて
FuelPHPを3ヶ月使ってみてFuelPHPを3ヶ月使ってみて
FuelPHPを3ヶ月使ってみて
 
日本は世界一のITコミュニティ天国
日本は世界一のITコミュニティ天国日本は世界一のITコミュニティ天国
日本は世界一のITコミュニティ天国
 
LL Planets告知
LL Planets告知LL Planets告知
LL Planets告知
 
the History of LL events
the History of LL eventsthe History of LL events
the History of LL events
 
Keires_DBリリースのご案内
Keires_DBリリースのご案内Keires_DBリリースのご案内
Keires_DBリリースのご案内
 
Traitsについて
TraitsについてTraitsについて
Traitsについて
 
PHPプログラミングのIPv6対応の実際
PHPプログラミングのIPv6対応の実際PHPプログラミングのIPv6対応の実際
PHPプログラミングのIPv6対応の実際
 
The Widgetization Of Media by Futurist Gerd Leonhard (MIPCOM 2008)
The Widgetization Of Media by Futurist Gerd Leonhard (MIPCOM 2008)The Widgetization Of Media by Futurist Gerd Leonhard (MIPCOM 2008)
The Widgetization Of Media by Futurist Gerd Leonhard (MIPCOM 2008)
 
LLまつりに行こう!
LLまつりに行こう!LLまつりに行こう!
LLまつりに行こう!
 
PHP Frameworks with IPv6
PHP Frameworks with IPv6PHP Frameworks with IPv6
PHP Frameworks with IPv6
 
IPv6の闇とPHP
IPv6の闇とPHPIPv6の闇とPHP
IPv6の闇とPHP
 
開発ライセンスとプログラマーの自由
開発ライセンスとプログラマーの自由開発ライセンスとプログラマーの自由
開発ライセンスとプログラマーの自由
 
PHPで使うIPv6の実際
PHPで使うIPv6の実際PHPで使うIPv6の実際
PHPで使うIPv6の実際
 
the Histrory of LT and ドラ娘
the Histrory of LT and ドラ娘the Histrory of LT and ドラ娘
the Histrory of LT and ドラ娘
 
FuelPHP で DynamoDB
FuelPHP で DynamoDBFuelPHP で DynamoDB
FuelPHP で DynamoDB
 

Similaire à ランダム文字ぽいものをつくる

The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistenceHugo Hamon
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tourSimon Proctor
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tourSimon Proctor
 
Introdução ao Perl 6
Introdução ao Perl 6Introdução ao Perl 6
Introdução ao Perl 6garux
 
Crazy things done on PHP
Crazy things done on PHPCrazy things done on PHP
Crazy things done on PHPTaras Kalapun
 
Top 10 php classic traps
Top 10 php classic trapsTop 10 php classic traps
Top 10 php classic trapsDamien Seguy
 
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdf
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdfphp global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdf
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdfanjalitimecenter11
 
The Perl6 Type System
The Perl6 Type SystemThe Perl6 Type System
The Perl6 Type Systemabrummett
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB jhchabran
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix itRafael Dohms
 
Hidden treasures of Ruby
Hidden treasures of RubyHidden treasures of Ruby
Hidden treasures of RubyTom Crinson
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developersStoyan Stefanov
 
How to write code you won't hate tomorrow
How to write code you won't hate tomorrowHow to write code you won't hate tomorrow
How to write code you won't hate tomorrowPete McFarlane
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Seri Moth
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)Jeff Eaton
 

Similaire à ランダム文字ぽいものをつくる (20)

PHP Tips & Tricks
PHP Tips & TricksPHP Tips & Tricks
PHP Tips & Tricks
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
Introdução ao Perl 6
Introdução ao Perl 6Introdução ao Perl 6
Introdução ao Perl 6
 
Crazy things done on PHP
Crazy things done on PHPCrazy things done on PHP
Crazy things done on PHP
 
Top 10 php classic traps
Top 10 php classic trapsTop 10 php classic traps
Top 10 php classic traps
 
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdf
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdfphp global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdf
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdf
 
The Perl6 Type System
The Perl6 Type SystemThe Perl6 Type System
The Perl6 Type System
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB
 
Bag of tricks
Bag of tricksBag of tricks
Bag of tricks
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix it
 
Presentation1
Presentation1Presentation1
Presentation1
 
Hidden treasures of Ruby
Hidden treasures of RubyHidden treasures of Ruby
Hidden treasures of Ruby
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developers
 
How to write code you won't hate tomorrow
How to write code you won't hate tomorrowHow to write code you won't hate tomorrow
How to write code you won't hate tomorrow
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02
 
Tgh.pl
Tgh.plTgh.pl
Tgh.pl
 
PHP 5.4
PHP 5.4PHP 5.4
PHP 5.4
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)
 

Dernier

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 

Dernier (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

ランダム文字ぽいものをつくる

  • 3. agenda id generate encode/decode 3
  • 4. RFC4648 The Base16, Base32, and Base64 Data Encodings Base 64 Encoding with URL and Filename Safe Alphabet base64url + → -, / → _ 4
  • 5. id generate DB Sequence id 1 → NWoZK3kTsExUV00Ywo1G5jlU 2 → 2kuSN7rMzfGcB2DKt67EqDWQ 5
  • 6. static public function genUniqHash($input, $options = null) { $seed = array_val($options, 'seed', 0); $length = array_val($options, 'length', 18); / 18 = non-padding max / static $search = array('+', '/'); static $replace = array('-', '_'); / limit check: sha1() returns 20 bytes / if (($length <= 0) || (20 < $length)) { $length = 20; } if (($seed + $length) > 20) { $seed = 20 - $length; } $out = base64_encode(substr(sha1($input, true), $seed, $length)); return str_replace($search, $replace, $out); } 6
  • 7. encode/decode gzip +base64url 7
  • 8. static public function tinyEncode($input) { static $search = array('+', '/'); static $replace = array('-', '_'); $gzed = gzdeflate($input); $encoded = base64_encode($gzed); $result = str_replace($search, $replace, $encoded); / trim trailing '=' / return rtrim($result, '='); } 8
  • 9. static public function tinyDecode($encoded) { static $search = array('-', '_'); static $replace = array('+', '/'); $str = str_replace($search, $replace, $encoded); $decoded = base64_decode($str); return gzinflate($decoded); } 9