JPWO2014041783A1 - Character string detection circuit and character string detection method - Google Patents
Character string detection circuit and character string detection method Download PDFInfo
- Publication number
- JPWO2014041783A1 JPWO2014041783A1 JP2014535372A JP2014535372A JPWO2014041783A1 JP WO2014041783 A1 JPWO2014041783 A1 JP WO2014041783A1 JP 2014535372 A JP2014535372 A JP 2014535372A JP 2014535372 A JP2014535372 A JP 2014535372A JP WO2014041783 A1 JPWO2014041783 A1 JP WO2014041783A1
- Authority
- JP
- Japan
- Prior art keywords
- character string
- input
- length
- detected
- match
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
- G06F16/90335—Query processing
- G06F16/90344—Query processing by using string matching techniques
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
入力文字列から検出文字列の先端を含む先端文字列の位置情報と一致情報とを検出する先端検出手段と、入力文字列から検出文字列の終端を含む終端文字列の位置情報と一致情報とを検出する終端検出手段と、検出文字列において先端文字列と終端文字列に挟まれた中間文字列の一致情報を入力文字列から検出する中間検出手段と、を有する一致検出手段と、位置情報及び一致情報を用いて入力文字列から一致長を考慮して検出文字列を検出する範囲長検出手段と、を備える文字列検出回路とする。Leading edge detecting means for detecting position information and matching information of the leading character string including the leading edge of the detected character string from the input character string; position information and matching information of the terminal character string including the end of the detecting character string from the input character string; Position detection means, and intermediate detection means for detecting match information of an intermediate character string sandwiched between the leading character string and the termination character string from the input character string in the detected character string, and position information And a range length detecting means for detecting a detected character string in consideration of the matching length from the input character string using the matching information.
Description
本発明は、文字列の一致検出をする文字列検出回路及び文字列検出方法に関する。特に、文字列の一致長を考慮した文字列検出装置及び文字列検出方法に関する。 The present invention relates to a character string detection circuit and a character string detection method for detecting matching of character strings. In particular, the present invention relates to a character string detection device and a character string detection method in consideration of the matching length of character strings.
文字列一致検出は、ネットワーク侵入検知や迷惑メールフィルタ等、産業界で様々な応用が存在する。とりわけ近年、文字列の一致長を考慮した一致検出に注目が集まっている。 Character string match detection has various applications in the industry, such as network intrusion detection and spam mail filter. In particular, in recent years, attention has been focused on matching detection in consideration of matching lengths of character strings.
例えば、最大一致長が2文字として任意のアルファベットとの一致検出を考える。この例では、AやABという文字列に関しては一致検出されるものの、ABCという文字列に関しては最大一致長が3となるために検出されない。このように、一致長を指定することで、より高精度な文字列一致検出を実現することができる。しかしながら、このような文字列の一致長を考慮した一致検出を高速に実現することは非常に困難であった。 For example, consider a match detection with an arbitrary alphabet with a maximum match length of 2 characters. In this example, the character strings A and AB are detected as being coincident, but the character string ABC is not detected because the maximum coincidence length is 3. Thus, by specifying the match length, more accurate character string match detection can be realized. However, it is very difficult to realize coincidence detection considering the coincidence length of character strings at high speed.
図9は、一般的な文字列の繰返しを考慮した一致検出を行う繰返し数制約付き文字列検出回路90を示した図である。なお、図9の方式の一例は、非特許文献1に開示されている。
FIG. 9 is a diagram showing a character
この例では、最小繰返しを1、最大繰返し数を40としている。文字列検出回路90では、入力文字列を、例えば、正規表現から生成される状態遷移機械91によって一致検出を行う。この状態遷移機械91は、もし一致していればカウンタ92に内部カウンタを増加させる信号を送る。すなわち、状態遷移が繰り返されるたびに、繰返し回数を1増やす。比較器93は内部カウンタの出力結果が1以上40以下であれば、一致情報を出力回路95へ送る。
In this example, the minimum repetition is 1 and the maximum number of repetitions is 40. In the character
続いて、非一致検出回路94は状態遷移機械91の内部状態を監視し、もし今後一致する可能性がなければカウンタ92と出力回路95にリセット信号を送る。カウンタ92はリセット信号により内部カウンタ値を0に戻す。すなわち、状態遷移が繰り返されなければ繰返し回数を0とし、出力回路95はリセット信号を受信した際に、比較器93の出力結果が一致していれば一致と判定し、一致結果を出力する。
Subsequently, the
図9に示した方式の状態遷移機械91は、1文字の繰返しからなる文字列に関しては、一致長を考慮した文字列の検出が可能である。1文字の繰返しからなる文字列とは「AAAAA」のような、特定の文字や任意の文字の繰返しとして表現される。この場合、「A」の繰返し数は5で、かつ、繰返し回数は5となるため、繰返し回数が一致長と同値になる。そのため、一致長を考慮した文字列の検出が可能となる。
The
図9に示した方式では、「ABBBC」という繰返し文字列ではない文字列の一致長を出力したい場合、入力文字列として「ABBBC」が与えられたとしても、AとCという異なる文字が付加されている。そのため、本方式では繰返し回数の1が出力され、実際の一致長である5は出力されない。 In the method shown in FIG. 9, when it is desired to output the matching length of a character string that is not a repeated character string “ABBBC”, different characters A and C are added even if “ABBBC” is given as the input character string. ing. Therefore, in this method, 1 is output as the number of repetitions, and 5 as the actual matching length is not output.
すなわち、図9に示した方式では、繰返しを持たない文字列に関しては、一致長を考慮した文字列として検出できないという課題があった。 That is, the method shown in FIG. 9 has a problem that a character string having no repetition cannot be detected as a character string in consideration of the matching length.
また、図9に示した方式では、単一の状態遷移機械によってシリアルに処理を行うため、多バイト入力による処理が難しい。そのため、多バイト入力によって、文字列を高速に処理することができないという課題があった。 Further, in the method shown in FIG. 9, since processing is performed serially by a single state transition machine, processing by multi-byte input is difficult. For this reason, there has been a problem that character strings cannot be processed at high speed by multi-byte input.
本発明は上述の課題を鑑みてなされたものであり、文字列の一致長を考慮した一致検出を、制限なく、かつ高速に処理する装置及び方法を提供することを目的とする。 The present invention has been made in view of the above-described problems, and an object of the present invention is to provide an apparatus and method for processing match detection in consideration of the match length of a character string at high speed without limitation.
本発明の文字列検出回路は、入力文字列から検出文字列の先端を含む先端文字列の位置情報と一致情報とを検出する先端検出手段と、入力文字列から検出文字列の終端を含む終端文字列の位置情報と一致情報とを検出する終端検出手段と、検出文字列の先端文字列と終端文字列に挟まれた中間文字列の一致情報を入力文字列から検出する中間検出手段と、を有する一致検出手段と、位置情報及び一致情報を用いて入力文字列から一致長を考慮して検出文字列を検出する範囲長検出手段と、を備える。 The character string detection circuit according to the present invention includes a leading end detection unit that detects position information and matching information of a leading character string including the leading end of the detected character string from the input character string, and a termination including the end of the detected character string from the input character string. End detection means for detecting position information and match information of the character string; intermediate detection means for detecting match information of the intermediate character string sandwiched between the leading character string and the end character string of the detected character string from the input character string; And a range length detecting means for detecting a detected character string in consideration of a match length from an input character string using position information and match information.
本発明の文字列検出方法は、入力文字列から検出文字列の先端を含む先端文字列の位置情報と一致情報との検出、入力文字列から検出文字列の終端を含む終端文字列の位置情報と一致情報との検出、及び検出文字列において先端文字列と終端文字列に挟まれた中間文字列の一致情報を入力文字列からの検出、を並列で行い、位置情報及び一致情報を用いて入力文字列から一致長を考慮して検出文字列を検出する。 The character string detection method of the present invention detects the position information and the matching information of the leading character string including the leading end of the detected character string from the input character string, and the positional information of the terminal character string including the end of the detected character string from the input character string. And the matching information are detected, and the matching information of the intermediate character string sandwiched between the leading character string and the terminal character string in the detected character string is detected from the input character string in parallel, and the position information and the matching information are used. A detection character string is detected from the input character string in consideration of the matching length.
本発明によれば、文字列の一致長を考慮した一致検出を、繰返し文字列に制限されずに実施することができる。また、一致検出を、多バイト入力を活用することで、非常に高速に処理することができる。 According to the present invention, match detection in consideration of the match length of a character string can be performed without being limited to repeated character strings. Also, match detection can be processed very quickly by utilizing multi-byte input.
以下において、本発明を実施するための形態について図面を参照しながら説明する。 Hereinafter, embodiments for carrying out the present invention will be described with reference to the drawings.
(第1の実施形態)
(文字列検出回路)
図1は、本発明の第1の実施形態に係る文字列検出回路1の構成例を示す図である。なお、本発明の実施形態に係る文字列検出回路1は、一致長制約付き文字列検出回路のことを指す。また、本発明の実施形態に係る文字列検出回路1は、正規表現の文字だけではなく、正規表現にはない記号やパターンなどの一致検出にも適応できる。(First embodiment)
(Character string detection circuit)
FIG. 1 is a diagram showing a configuration example of a character
図1を参照すると、文字列検出回路1は、先端検出部2、中間検出部3、終端検出部4及び範囲長検出部5を備えている。
Referring to FIG. 1, the character
文字列検出回路1は、入力された文字列と検出文字列との比較を行い、一致長を考慮してそれらの一致を判定する回路である。
The character
先端検出部2、中間検出部3、終端検出部4は、入力された文字列から、検出文字列の先端文字列、中間文字列、終端文字列のそれぞれを検出する。なお、先端検出部2、中間検出部3、終端検出部4は、それぞれ別の構成要素としているが、これらの検出機能を一つの一致検出部として実現することができれば、必ずしも検出部の全てを個別の構成要素としなくてもよい。
The leading edge detection unit 2, the
範囲長検出部5は、先端検出部2、中間検出部3、終端検出部4から出力された結果を入力し、それらの結果から入力された文字列と検出文字列の一致を判定する。
The range
なお、上述の各構成要素の詳細については、後ほどあらためて説明する。 Note that details of each of the above-described components will be described later.
(検出文字列)
図2は、本発明の第1の実施形態に係る文字列検出回路1が検出する検出文字列20の構成を示す図である。(Detection string)
FIG. 2 is a diagram showing a configuration of the detected
検出文字列20は、先端文字列21、中間文字列22及び終端文字列23からなる。
The detected
先端文字列21及び終端文字列23は、それぞれ検出文字列20の先端、終端を含む文字列である。先端文字列21及び終端文字列23には、一般に中間文字列22とは異なる符号が割り当てられている。また、先端文字列21及び終端文字列23の文字長は任意であり、例えば、1バイト以上などと指定できる。
The leading
中間文字列22は、一致長を考慮する文字列に相当する。なお、一致長とは、先端文字列21と終端文字列23に挟まれた中間文字列22の文字数を示す。また、一致長は、最小長または最大長のいずれか一方、もしくは最小長及び最大長の両方を含む範囲として設定される。中間文字列22は、一致長のみを考慮すればよいため、文字数のみを定義すればよい。ただし、中間文字列22については、必要に応じて特定の文字列を含むこととしても構わない。
The
例えば、検出文字列20を、「ABC・・・CYZ」とし、先端文字列21をAB、終端文字列23をYZ、中間文字列22をCの繰返し文字列と定義する。仮に、最大一致長を5とすると、「ABYZ」、「ABCYZ」、「ABCCYZ」、「ABCCCYZ」、「ABCCCCYZ」、「ABCCCCCYZ」という文字列が検出対象となる。しかしながら、「ABCCCCCCYZ」は、中間文字列22の一致長が6となるため、検出対象外である。この例では、中間文字列22としてCの繰返し文字列をあげたが、中間文字列22は任意の文字で構成されていてもよく、一致長のみを検出対象とする。
For example, the detected
本発明の第1の実施形態に係る文字列検出回路1では、検出文字列20と完全一致した文字列のみを検出対象とするのではなく、先端文字列21、終端文字列23と完全一致し、指定した一致長の条件に合致する中間文字列22を含む文字列が検出対象となる。
In the character
このように、任意の文字列において先端文字列21及び終端文字列23を規定することができるため、本発明の実施形態に係る検出文字列の定義は、一般的な文字列に適用できる。
As described above, since the leading
なお、検出文字列20は、論理回路として実現されてもよいし、記憶素子に格納されていてもよいし、一般に文字が判定できる方式であればどのような実装でも構わない。
The detected
(入力文字列)
図3は、本発明の第1の実施形態に係る文字列検出回路1に入力される入力文字列30の構成を示す図である。入力文字列30としては、正規表現などで表される文字列を取り扱うことができる。また、正規表現で表されていない記号やパターンなどを含む記号列を文字列として取り扱うこともできる。(Input string)
FIG. 3 is a diagram showing the configuration of the
入力文字列30は、任意長の文字列からなる複数個の部分文字列31a、31b、・・・、31nから構成される。この入力文字列30から検出文字列20と一致長を考慮した上で一致する文字列を検出する。なお、本発明の実施形態においては、部分文字列31a、31b、・・・、31nを用いて説明する際に、特に区別する必要がないときは部分文字列31と記載する。
The
例えば、入力文字列30が「ABCCCCCCCCYZ」であるとする。文字列検出回路1が一度に処理できる最大の文字列長が4である場合、部分文字列31は、「ABCC」、「CCCC」、「CCYZ」に設定できる。無論、最大の文字列長が入力文字列長より大きければ、入力文字列30を一度に文字列検出回路1へと入力することができる。
For example, it is assumed that the
ただし、部分文字列31a、31b、・・・、31nのそれぞれの長さは、全て同じに設定してもよく、文字列の出現順などに応じて設定してもよい。
However, the lengths of the
なお、部分文字列31は、それぞれ符号部分とデータ部分を含んでいてもよく、また、それぞれの部分文字列31を指定したアドレスに保存することができるのであれば、データ部分のみから構成されていてもよい。 The partial character string 31 may include a code part and a data part, respectively. If each partial character string 31 can be stored at a specified address, the partial character string 31 includes only a data part. May be.
(動作)
以下において、図4及び図5を用いて本発明の第1の実施形態に係る文字列検出回路1の動作を説明する。(Operation)
The operation of the character
図4は、部分文字列41と部分文字列と42からなる入力文字列40である。入力文字列40は、図3の入力文字列30の一例である。
FIG. 4 shows an
図5は、本発明の第1の実施形態に係る文字列検出回路1における入力方式の一例を示した図である。
FIG. 5 is a diagram showing an example of an input method in the character
文字列検出回路1は、部分文字列41及び部分文字列42が存在したときに、一致長を考慮した文字列検出を行う。
The character
文字列検出回路1に対して、時刻T0では部分文字列41を入力し、時刻T1では部分文字列42を入力する。すなわち、これらの部分文字列41、42は、ある時刻で、順序良く文字列検出回路1に入力される。この際、入力文字列40は、先端検出部2、中間検出部3及び終端検出部4に同時刻に入力されることになる。そのため、先端文字列21、中間文字列22、終端文字列23のそれぞれにおいて、並列で文字列検出される。そのため、高速での文字列検出処理が可能となる。
A
なお、部分文字列41、42を文字列検出回路1に入力するタイミングは、範囲長検出部5の処理能力に応じて決定される。例えば、範囲長検出部5が並列処理できない場合、部分文字列42は、部分文字列41の文字列検出処理が終了してから文字列検出回路1に入力すればよい。
The timing at which the
また、文字列検出回路1において並列処理が可能であれば、部分文字列41の文字列検出処理が実行中であっても、部分文字列41を文字列検出回路1に入力してもよい。例えば、先端検出部2、中間検出部3及び終端検出部4を複数設けたり、それぞれの検出部の内部処理を並行にしたり、それぞれの検出部の内部に記憶装置を設けたりすることによって、並行処理が可能となる。また、パイプライン方式で検出処理を実行することが可能であれば、並列処理を連続的に実行することができるため、さらに高速な処理が可能となる。なお、部分文字列41、42の入力方式によって、一致長を考慮した文字列検出が実施されるが、本発明の第1の実施形態に係る文字列検出回路1の検出方式は、ここであげたものに限らない。
If the character
以下において、文字列検出回路1の構成を詳細に説明する。例として、入力文字列30を「FFABCCCCYZFF」とし、先端文字列21を「AB」、終端文字列23を「YZ」、中間文字列22をCの繰返し文字列と定義する。この時、最大一致長を5とし、部分文字列の長さは4とする。
Hereinafter, the configuration of the character
(先端検出部)
先端検出部2は、部分文字列31を入力とし、その部分文字列31における先端文字列21を検出する。(Tip detector)
The leading edge detector 2 receives the partial character string 31 and detects the leading
先端文字列21が検出された場合には、先端位置11と先端一致情報12とを範囲長検出部5へと送信する。
When the leading
先端位置11とは、部分文字列31内における先端文字列21の位置を示す。ここで、位置とは部分文字列31におけるオフセットを意味する。例えば、先端文字列21の末尾の文字位置で定義することができる。一般に、オフセットとは先頭からの距離を表わす整数であるが、本実施形態においては、部分文字列31の左または右からのどちらからでも位置を指定可能である。例えば、部分文字列31の左を基準として位置を指定する場合、「FFAB」を入力すると、先端文字列「AB」は先頭から数えると3番目に位置しているので、先端位置11は3となる。
The
また、先端一致情報12とは、部分文字列31内のいずれかの文字列が、先端文字列21と一致したか否か、または、一致途上か、のいずれかを示す。すなわち、先端一致情報12は、一致、不一致、一致途上の3つの情報を含む。ここで、一致途上とは、先端文字列21の長さが1以上の場合において、先端文字列21が連続する部分文字列31にまたがっている場合を意味する。
The leading
(中間検出部)
中間検出部3は、部分文字列31を入力とし、その部分文字列31において、中間文字列22を検出する。(Intermediate detector)
The
中間文字列22が検出された場合には、一致したか否かを示す中間一致情報13を、範囲長検出部5へと送信する。ここで、中間文字列22の一致情報は、一致長が所定の範囲内にあるか否かを示すことになる。
When the
(終端検出部)
終端検出部4は、部分文字列31を入力とし、その部分文字列31において、終端文字列23を検出する。(Termination detector)
The end detection unit 4 receives the partial character string 31 and detects the
終端文字列23が検出された場合には、終端位置14と終端一致情報15とを範囲長検出部5へと送信する。
When the
終端位置14とは、部分文字列23内における終端文字列23の位置を示す。例えば終端文字列23が始まる文字位置で定義することができる。例えば、部分文字列31の左を基準として位置を指定する場合、「YZFF」を入力すると、終端文字列「ZF」はその部分文字列31においては先頭から数えると2番目に位置している。ここで、それまでに入力した部分文字列長に2を加えた数値が終端位置14となる。
The
また、終端一致情報15とは、部分文字列31内のいずれかの文字列が、終端文字列23と一致したか否か、一致途上か、のいずれかを示す。すなわち、終端一致情報15は、一致、不一致、一致途上の3つの情報を含む。
The
(範囲長検出部)
範囲長検出部5は、先端検出部2から出力された先端位置11及び先端一致情報12、中間検出部3から出力された中間一致情報13、終端検出部4から出力された終端位置14及び終端一致情報15、といった位置情報と一致情報を入力とする状態遷移機械を構成する。範囲長検出部5は、内部に図示しないカウンタを備える。そのため、最小一致長または最大一致長のいずれか一方、もしくは最小一致長及び最大一致長の両方を考慮することが可能である。(Range length detector)
The range
図6は、本発明の第1の実施形態に係る範囲長検出部5の構成図である。なお、カウンタは図示していない。
FIG. 6 is a configuration diagram of the
図6を参照すると、範囲長検出部5は、未検出状態61、検出中状態62、半終端状態63の3状態からなる状態遷移機械60として構成される。
Referring to FIG. 6, the range
未検出状態61は、検出する文字列を検出していない状態であり、いわゆる初期状態に相当する。
The
検出中状態62は、先端位置11と先端一致情報12、中間検出部3から出力された中間一致情報13を元に、検証対象の文字列を検証している状態に対応する。
The detecting
半終端状態63は、終端文字列23が次に入力される部分文字列31にまたがっている状態、すなわち、終端文字列23である可能性はあるが次の時刻まで終端文字列23であるか否かの判断がつかない場合に遷移する状態である。
The
ただし、本発明の実施形態に係る範囲長検出部5は、先端検出部2、中間検出部3、終端検出部4によって抽出された情報から、範囲長を算出できる回路でありさえすればよく、図6の構成に限定されるわけではない。
However, the range
ここで、図6に示した状態遷移機械60の状態遷移条件について詳細に説明する。なお、これ以降の説明においては、数値範囲を「〜以上、〜以下」という表現で範囲しているが、これは、「〜より大きい」、「〜より小さい」といった、一般の範囲表現に適宜置換することが可能である。また、以下の状態遷移条件の説明においては、先端位置11及び終端位置14は、文字列の左端、右端などといった同じ基準に対する位置で定義する。
Here, the state transition conditions of the
以下の説明においては、一般的な文字列を入力することを想定し、実施形態としてはS1〜S9という状態遷移条件について説明している。 In the following description, it is assumed that a general character string is input, and state transition conditions S1 to S9 are described as embodiments.
また、「FFABCCCCYZFF」を入力文字列30とし、先端文字列「AB」、中間文字列「C・・・C」、終端文字列「YZ」からなる「ABC・・・CYZ」を検出文字列20とした例を交えて説明を加える。なお、以下に加える説明は一例であり、部分文字列31の長さは、各状態遷移条件において任意に設定した値であって、本発明の実施形態を限定するものではない。
Further, “FFABCCCCCYZFF” is set as the
(状態遷移条件S1)
状態遷移条件S1は、未検出状態61において、先端文字列21の一致情報が一致を示し、中間文字列22の一致情報が一致を示し、終端文字列23の一致情報が一致を示した場合の遷移条件である。(State transition condition S1)
In the state transition condition S1, in the
状態遷移条件S1では、未検出状態61から未検出状態61へと遷移する。
In the state transition condition S1, a transition is made from the
ここで、終端位置14と先端位置11との差が、指定された最小長以上かつ指定された最大長以下という所定の範囲内に含まれるため、中間文字列22の一致長が一致と判定されることになり、一致結果を出力する。なお、最小長には0または1、最大長には1以上無限大が指定可能である。
Here, since the difference between the
例えば、「FFABCCCCYZFF」を入力する例において、「FFABCCCCYZFF」を入力した場合が、この条件に相当する。 For example, in the example of inputting “FFABCCCCYZFF”, the case where “FFABCCCCYZFF” is input corresponds to this condition.
(状態遷移条件S2)
状態遷移条件S2は、未検出状態61において、先端文字列21の一致情報が一致を示し、中間文字列22の一致情報が一致を示し、終端文字列23の一致情報が不一致を示した場合の遷移条件である。(State transition condition S2)
In the state transition condition S2, in the
状態遷移条件S2では、未検出状態61から検出中状態62へと遷移する。
In the state transition condition S2, a transition is made from the
ここで、部分文字列長と先端位置11から算出された中間文字列22の一致長をカウンタに代入する。すなわち、先端文字列21が検出され、中間文字列は未だ所定の範囲内にあるため、終端文字列23の検出待ちの状態となる。
Here, the matching length of the
例えば、「FFABCCCCYZFF」を入力する例において、「FFAB」を入力した場合が、この条件に相当する。「FFAB」を入力した場合、中間文字列の一致長は0なので、カウンタには0を代入する。 For example, in the example of inputting “FFABCCCCCYZFF”, the case where “FFAB” is input corresponds to this condition. When “FFAB” is input, the match length of the intermediate character string is 0, so 0 is substituted for the counter.
(状態遷移条件S3)
状態遷移条件S3は、検出中状態62において、先端文字列21の一致情報が不一致を示し、中間文字列22の一致情報が一致、終端文字列23の一致情報が不一致を示した場合の遷移条件である。(State transition condition S3)
The state transition condition S3 is a transition condition when the matching information of the leading
状態遷移条件S3では、検出中状態62から検出中状態62へと遷移する。
In the state transition condition S3, a transition is made from the detecting
ここで、部分文字列長をカウンタに加算する。この遷移条件では、先端文字列21との一致は既に検出されており、終端文字列23が未だ未検出であるため、中間文字列22が所定の範囲内にあるうちは検出中状態62を維持することを示している。
Here, the partial character string length is added to the counter. Under this transition condition, a match with the leading
例えば、「FFABCCCCYZFF」を入力する例において、「CCCC」を入力した場合が、この条件に相当する。中間文字列22「CCCC」を入力した場合、カウンタに4を加算することになる。
For example, in the example of inputting “FFABCCCCCYZFF”, the case where “CCCC” is input corresponds to this condition. When the
(状態遷移条件S4)
状態遷移条件S4は、検出中状態62において、先端文字列21の一致情報が不一致を示し、中間文字列22の一致情報が一致を示し、終端文字列23の一致情報が一致を示した場合の遷移条件である。(State transition condition S4)
The state transition condition S4 is a case where, in the detecting
状態遷移条件S4では、検出中状態62から未検出状態61へと遷移する。
In the state transition condition S4, a transition is made from the detecting
ここで、部分文字列長と終端位置14から算出された、中間文字列22の一致長をカウンタに加算する。その結果、中間文字列の一致長が指定された最小長以上かつ指定された最大長以下という所定の範囲内であれば、先端文字列21と、中間文字列22の一致長と、終端文字列23が一致することになるため、一致結果を出力する。なお、最小長には0または1、最大長には1以上無限大が指定可能である。
Here, the matching length of the
例えば、「FFABCCCCYZFF」を入力する例において、「YZFF」を入力した場合が、この条件に相当する。「YZFF」を入力した場合、中間文字列22の一致長は0なので、カウンタには0を代入する。ここで、状態遷移条件S3の結果と合わせると、その一致長は4である。すなわち、指定された最大長を5とすると、入力文字列30と検出文字列20とは一致すると判定され、文字列検出回路1からは、一致結果が出力される。
For example, in the example of inputting “FFABCCCCCYZFF”, the case where “YZFF” is input corresponds to this condition. When “YZFF” is input, since the matching length of the
(状態遷移条件S5)
状態遷移条件S5は、検出中状態62において、先端文字列21の一致情報が不一致を示し、中間文字列22の一致情報が一致、終端文字列23の一致情報が一致途上を示した場合の遷移条件である。(State transition condition S5)
The state transition condition S5 is a transition when the matching information of the leading
状態遷移条件S5では、部分文字列長と終端位置14から算出された、中間文字列22の一致長をカウンタに加算する。その結果、中間文字列22の一致長が指定された最小長以上かつ指定された最大長以下であれば、検出中状態62から半終端状態63へと遷移する。すなわち、先端文字列21は既に検出され、中間文字列22は一致長が一致と判定され、終端文字列23が途中まで検出された状態となる。
In the state transition condition S5, the match length of the
例えば、「FFABCCCCYZFF」を入力する例において、既に先端文字列「AB」が検出済みであり、そこに「CCCY」を入力した場合が、この条件に相当する。「CCCY」を入力した場合、終端文字列「YZ」の途中までが検出された状態となる。 For example, in the example of inputting “FFABCCCCCYZFF”, the case where the leading character string “AB” has already been detected and “CCCY” is input thereto corresponds to this condition. When “CCCY” is input, the middle of the termination character string “YZ” is detected.
(状態遷移条件S6)
状態遷移条件S6は、未検出状態61において、先端文字列21の一致情報が一致を示し、中間文字列22の一致情報が一致、終端文字列の一致情報が一致途上を示した場合の遷移条件である。(State transition condition S6)
The state transition condition S6 is a transition condition when the matching information of the leading
状態遷移条件S6では、部分文字列長と終端位置14から算出された、中間文字列22の一致長をカウンタに加算する。その結果、指定された最小長以上かつ指定された最大長以下であれば、未検出状態61から半終端状態63へと遷移する。
In the state transition condition S6, the match length of the
例えば、「FFABCCCCYZFF」を入力する例において、「ABCCCY」を入力した場合が、この条件に相当する。「FFABCCCY」を入力した場合、終端文字列23「YZ」の途中までが検出された状態となる。
For example, in the example of inputting “FFABCCCCYZFF”, the case where “ABCCCY” is input corresponds to this condition. When “FFABCCY” is input, the middle of the
(状態遷移条件S7)
状態遷移条件S7は、半終端状態63において、先端文字列21の一致情報が不一致を示し、中間文字列22の一致情報が一致、終端文字列23の一致情報が一致を示した場合の遷移条件である
状態遷移条件S7では、半終端状態63から未検出状態61へと遷移する。(State transition condition S7)
The state transition condition S7 is a transition condition when the match information of the leading
この場合、既に先端文字列21は検出済みであり、中間文字列22の一致長は所定の範囲内にあり、終端文字列23も一致したことになるため、無条件で一致結果を出力する。
In this case, since the leading
例えば、「FFABCCCCYZFF」を入力する例において、既に先端文字列「AB」が検出済みであり、そこに「CYZFF」を入力した場合が、この条件に相当する。「CYZFF」を入力した場合、中間文字列22と終端文字列23の両方が一致と判定されるため、検出文字列20が検出されたことになる。
For example, in the example of inputting “FFABCCCCCYZFF”, the case where the leading character string “AB” has already been detected and “CYZFF” is input thereto corresponds to this condition. When “CYZFF” is input, it is determined that both the
(状態遷移条件S8)
状態遷移条件S8は、検出中状態62において、状態遷移条件S3、S4、S5の、いずれの条件も満足しない場合の遷移条件である。(State transition condition S8)
The state transition condition S8 is a transition condition when none of the state transition conditions S3, S4, and S5 is satisfied in the detecting
状態遷移条件S8では、検出中状態62から未検出状態61へと遷移する。
In the state transition condition S8, a transition is made from the detecting
すなわち、先端文字列21は検出されていたものの、中間文字列22が一致長の範囲内になかった場合、もしくは終端文字列23が一致条件を満たさなかった場合などに未検出状態61に遷移する条件である。
That is, when the leading
例えば、「ABC・・・CYZ」を検出文字列20とし、中間文字列22の一致長を5とした場合に、「FFABCCCCCCYZFF」や「FFABCCCCYKFF」などを入力する際に状態遷移条件S8を取りうる。
For example, when “ABC... CYZ” is the
(状態遷移条件S9)
状態遷移条件S9は、半終端状態63において、状態遷移条件S7を満足しない場合の遷移条件である。(State transition condition S9)
The state transition condition S9 is a transition condition when the state transition condition S7 is not satisfied in the
状態遷移条件S9では、半終端状態63から未検出状態61へと遷移する。
In the state transition condition S9, a transition is made from the half-
すなわち、先端文字列21は検出され、中間文字列22の一致条件も満たされ、終端文字列23の一部が一致していたところに、ある部分文字列31が入力され、中間文字列22の一致情報が不一致、もしくは終端文字列23の一致情報が不一致となった際の条件である。
That is, the leading
例えば、「ABC・・・CYZ」を検出文字列20とした場合において、入力文字列30「FFABCCCCYKFF」を、「FFABC」、「CCCY」、「KFF」などの部分文字列31として入力する際に状態遷移条件S9を取りうる。
For example, when “ABC... CYZ” is set as the detected
このように、本発明の第1の実施形態によると、入力された文字列に対して、先端情報11及び先端一致情報12と、終端情報14及び終端一致情報15と、中間一致情報13といった位置情報と一致情報から、指定された範囲長の中間文字列22を検出することができる。
As described above, according to the first embodiment of the present invention, positions such as the
以上が、本発明の第1の実施形態に係る範囲長検出部5の状態遷移条件の説明である。なお、本発明の第1の実施形態に係る範囲長検出部5の状態遷移条件は、上述の条件に限定されず、各状態遷移条件に種々の変形を加えてもよい。
The above is the description of the state transition condition of the range
以上のように、本発明の第1の実施形態に係る文字列検出回路1によれば、先端文字列21と終端文字23に着目することで、繰返し文字列に留まらない幅広い、一致長を考慮した文字列検出処理が可能である。
As described above, according to the character
また、部分文字列31を状態遷移機械60で直接受信するのではなく、先端検出部2、中間検出部3、終端検出部4において抽出された情報によって状態遷移機械60を駆動する。すなわち、多バイト入力を活用して処理することになるため、非常に高速な処理が可能となる。
Further, the
このように、本発明の第1の実施形態に係る文字列検出回路1によれば、重要な情報を抽出してから状態遷移機械を活用するため、非常に高速な処理が可能となっている。
As described above, according to the character
(第2の実施形態)
図7に、本発明の第2の実施形態に係る文字列検出回路70を示した。(Second Embodiment)
FIG. 7 shows a character
第2の実施形態に係る文字列検出回路70は、先端検出部72、中間検出部73、終端検出部74、範囲長検出部75及び文字列処理部71を備えている。すなわち、文字列検出回路70においては、第1の実施形態に係る文字列検出回路1に、文字列処理部71が追加されている。なお、それぞれの文字列検出部の出力結果は第1の実施形態と同じであるため、出力結果の流れを矢印のみで示した。
The character
文字列処理部71は、入力文字列30を所定の長さの部分文字列31に分割する。なお、分割する文字列の長さは、任意に設定可能である。
The character
文字列処理部71は、入力文字列30を、等分としたり、先端文字列21や終端文字列23の長さを基準とした長さとしたり、中間文字列22を基準とした長さにすることができる。
The character
例えば、入力文字列30が「ABCCCCCCCCYZ」である場合、3等分すると、「ABCC」、「CCCC」、「CCYZ」と設定できる。また、先端文字列21や終端文字列23に符号が含まれることが分かっている場合など、その符号の長さを考慮して部分文字列を設定してもよい。
For example, when the
また、検出文字列20の長さよりも、部分文字列31の長さが長くなるような値を設定してもよいし、反対に部分文字列31の長さが変化するように設定してもよい。
Further, a value that makes the length of the partial character string 31 longer than the length of the detected
例えば、部分文字列31を入力していくにつれて、部分文字列31の長さを次第に短くしたり、次第に長くしたりすることができる。例えば、入力文字列30が「ABCCCCCCCCYZ」である場合、部分文字列31を「ABCCC」、「CCCC」、「CYZ」としたり、「ABC」、「CCCC」、「CCCYZ」としたりできる。
For example, as the partial character string 31 is input, the length of the partial character string 31 can be gradually shortened or gradually increased. For example, when the
また、部分文字列31の長さをランダムに設定してもよく、例えば、「AB」、「CCCCCC」、「YZ」とすることもできる。なお、入力文字列30を分割して部分文字列31を生成する方法はここにあげた限りではなく、各検出部の処理能力や外部の入力元・出力先にある装置の性能や設定に応じて任意に設定可能である。
Further, the length of the partial character string 31 may be set at random, for example, “AB”, “CCCCCC”, and “YZ”. Note that the method of generating the partial character string 31 by dividing the
ただし、文字列処理部71による入力文字列30の分割は、ここであげた限りではない。
However, the division of the
図8は、文字列処理部71の構成の一例を示す図である。
FIG. 8 is a diagram illustrating an example of the configuration of the character
図8に示した文字列処理部71は、文字列分割部81と、記憶部82と、タイミング部83と、選択部84と、出力部85と、を備えている。
The character
文字列分割部81は、入力文字列30を所定の長さに分割し、部分文字列31を作製する。入力文字列30を分割する長さは、任意に設定可能である。例えば、文字列分割部81は、入力文字列30を、等分してもよく、検出文字列20の長さに応じて設定された長さに分割してもよく、ランダムな長さに分割してもよい。さらに、入力文字列30の符号部分の長さが予め分かっている場合は、符号部分のみを取り出し、それ以外のデータ部分を任意の長さに分割してもよい。
The character
記憶部82は、所定の長さに分割された部分文字列31を記憶する。
The
タイミング部83は、選択部84に、記憶部82から部分文字列31を取得するタイミングで信号を送信する。タイミング部83は、設定されたタイミングで信号を送信できる。また、タイミング部83を範囲長検出部75内部のカウンタと同期させれば、範囲長検出部75の処理に合わせて信号を送信することもできる。外部の演算処理装置に設けられたカウンタと同期させる場合は、そのカウンタのタイミングに合わせて処理を行えばよい。
The
選択部84は、タイミング部83からの信号のタイミングに応じて、記憶部82から部分文字列31を選択し、出力部85に送信する。
The
出力部85は、選択部84から送信されてきた部分文字列31を出力する。なお、選択部84と出力部85は、共通の構成要素としてもよい。
The
以上が文字列処理部71の構成及び動作の簡単な説明である。なお、文字列処理部71は、入力文字列30を分割しさえすれば、上述の構成及び動作に限定することはない。
The above is a brief description of the configuration and operation of the character
以上のように、第2の実施形態に係る文字列検出回路70によれば、文字列検出回路70に入力文字列30を入力する前に、部分文字列31に分割しなくても入力文字列30をそのままの形で入力することができる。また、部分文字列31の入力タイミングを設定しなくても、内部のタイミング部83のタイミングで部分文字列31を範囲長検出部75に送信できる。このように、第2の実施形態の文字列検出回路70によれば、入力文字列30は、範囲長検出部75が処理しやすい長さに分割されるため、さらに高速での処理が可能となる。
As described above, according to the character
以上、本発明を上記実施形態に即して説明したが、本発明は、上記実施形態の構成や動作にのみ限定されるものではなく、本発明の範囲内で当業者であればなしうることが可能な各種変形、修正を含むことはもちろんである。 Although the present invention has been described with reference to the above embodiment, the present invention is not limited only to the configuration and operation of the above embodiment, and can be made by those skilled in the art within the scope of the present invention. Of course, it includes various possible variations and modifications.
この出願は、2012年9月11日に出願された日本出願特願2012−199015を基礎とする優先権を主張し、その開示の全てをここに取り込む。 This application claims the priority on the basis of Japanese application Japanese Patent Application No. 2012-199015 for which it applied on September 11, 2012, and takes in those the indications of all here.
1 文字列検出回路
2 先端検出部
3 中間検出部
4 終端検出部
5 範囲長検出部
20 検出文字列
21 先端文字列
22 中間文字列
23 終端文字列
30 入力文字列
31 部分文字列
40 入力文字列
41、42 部分文字列
61 未検出状態
62 検出中状態
63 半終端状態
70 文字列検出回路
71 文字列処理部
72 先端検出部
73 中間検出部
74 終端検出部
75 範囲長検出部
81 文字列分割部
82 記憶部
83 タイミング部
84 選択部
85 出力部
90 文字列検出回路
91 状態遷移機械
92 カウンタ
93 比較器
94 非一致検出回路
95 出力回路DESCRIPTION OF
Claims (10)
前記位置情報及び前記一致情報を用いて前記入力文字列から一致長を考慮して前記検出文字列を検出する範囲長検出手段と、を備えることを特徴とする文字列検出回路。Leading edge detecting means for detecting position information and matching information of the leading character string including the leading edge of the detected character string from the input character string, and matching with positional information of the terminal character string including the end of the detected character string from the input character string End detection means for detecting information, and intermediate detection means for detecting match information between the leading character string of the detected character string and an intermediate character string sandwiched between the end character strings from the input character string Detection means;
A character string detection circuit comprising: range length detection means for detecting the detected character string from the input character string in consideration of the match length using the position information and the match information.
前記複数の部分文字列はそれぞれタイミングをずらして前記一致検出手段に入力されることを特徴とする請求項1または2に記載の文字列検出回路。The input character string is divided into a plurality of partial character strings,
3. The character string detection circuit according to claim 1, wherein the plurality of partial character strings are input to the coincidence detection unit at different timings.
前記複数の部分文字列を入力された順に処理することを特徴とする請求項3に記載の文字列検出回路。The range length detecting means includes
The character string detection circuit according to claim 3, wherein the plurality of partial character strings are processed in an input order.
前記先端文字列及び前記終端文字列の一致とともに、前記中間文字列の一致長を考慮した一致を検出する状態遷移機械を備え、
前記状態遷移機械は、前記位置情報及び前記一致情報を入力とし、前記中間文字列の一致長を加算するカウンタを備えることを特徴とする請求項1乃至4のいずれか一項に記載の文字列検出回路。The range length detecting means includes
A state transition machine that detects a match in consideration of a match length of the intermediate character string together with a match of the leading character string and the terminal character string,
5. The character string according to claim 1, wherein the state transition machine includes a counter that receives the position information and the match information and adds a match length of the intermediate character string. Detection circuit.
前記先端文字列が検出されていない未検出状態と、
前記先端文字列の位置情報及び一致情報と前記中間文字列の一致情報を基に前記検出文字列が検出されている検出中状態と、
前記終端文字列が部分的に検出されている半終端状態と、を有することを特徴とする請求項5に記載の文字列検出回路。The state transition machine is:
An undetected state in which the leading character string is not detected;
A detecting state in which the detected character string is detected based on position information and matching information of the leading character string and matching information of the intermediate character string;
The character string detection circuit according to claim 5, further comprising: a semi-terminal state in which the terminal character string is partially detected.
前記範囲長検出手段は、
前記終端文字列を部分的に検出した際に、前記部分文字列の長さと前記終端位置とから算出された前記中間文字列の一致長を前記カウンタに加算し、
前記カウンタのカウンタ値が所定の範囲内である場合は前記半終端状態へと遷移し、
前記カウンタのカウンタ値が前記所定の範囲内にない場合は前記未検出状態へと遷移することを特徴とする請求項5または6に記載の文字列検出回路。In the detecting state,
The range length detecting means includes
When partially detecting the end character string, the matching length of the intermediate character string calculated from the length of the partial character string and the end position is added to the counter,
When the counter value of the counter is within a predetermined range, transition to the half-terminal state,
7. The character string detection circuit according to claim 5, wherein when the counter value of the counter is not within the predetermined range, the state shifts to the undetected state.
前記範囲長検出手段は、
前記終端文字列が検出された場合、前記カウンタのカウンタ値が所定の範囲内である場合は一致結果を出力して前記未検出状態へと遷移し、
前記カウンタのカウンタ値が前記所定の範囲内にない、もしくは前記終端文字列が検出されなかった場合、一致結果を出力することなく前記未検出状態へと遷移することを特徴とする請求項5または6に記載の文字列検出回路。In the half-terminated state,
The range length detecting means includes
When the termination character string is detected, if the counter value of the counter is within a predetermined range, a match result is output and transition to the undetected state,
6. If the counter value of the counter is not within the predetermined range, or if the terminal character string is not detected, transition is made to the undetected state without outputting a match result. 6. The character string detection circuit according to 6.
前記位置情報及び前記一致情報を用いて前記入力文字列から一致長を考慮して前記検出文字列を検出することを特徴とする文字列検出方法。Detection of position information and matching information of the leading character string including the leading end of the detection character string from the input character string, detection of position information and matching information of the terminal character string including the end of the detection character string from the input character string, And detecting from the input character string the matching information of the intermediate character string sandwiched between the leading character string and the terminal character string in the detected character string,
A character string detection method for detecting the detected character string in consideration of a match length from the input character string using the position information and the match information.
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012199015 | 2012-09-11 | ||
JP2012199015 | 2012-09-11 | ||
PCT/JP2013/005319 WO2014041783A1 (en) | 2012-09-11 | 2013-09-09 | Circuit for detecting character string and method for detecting character string |
Publications (1)
Publication Number | Publication Date |
---|---|
JPWO2014041783A1 true JPWO2014041783A1 (en) | 2016-08-12 |
Family
ID=50277925
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014535372A Pending JPWO2014041783A1 (en) | 2012-09-11 | 2013-09-09 | Character string detection circuit and character string detection method |
Country Status (2)
Country | Link |
---|---|
JP (1) | JPWO2014041783A1 (en) |
WO (1) | WO2014041783A1 (en) |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7702629B2 (en) * | 2005-12-02 | 2010-04-20 | Exegy Incorporated | Method and device for high performance regular expression pattern matching |
JP4957500B2 (en) * | 2007-10-12 | 2012-06-20 | 日本電気株式会社 | String matching circuit |
WO2009147794A1 (en) * | 2008-06-04 | 2009-12-10 | 日本電気株式会社 | Finite automaton generating system |
-
2013
- 2013-09-09 JP JP2014535372A patent/JPWO2014041783A1/en active Pending
- 2013-09-09 WO PCT/JP2013/005319 patent/WO2014041783A1/en active Application Filing
Also Published As
Publication number | Publication date |
---|---|
WO2014041783A1 (en) | 2014-03-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4957500B2 (en) | String matching circuit | |
US8972450B2 (en) | Multi-stage parallel multi-character string matching device | |
KR101370231B1 (en) | Bit sequence generation device and bit sequence generation method | |
CN109614790B (en) | Lightweight authentication equipment and authentication method based on feedback loop PUF | |
JP6113091B2 (en) | Hash value generator | |
CN110546640A (en) | Hierarchical pattern matching for deep packet analysis | |
Geffert et al. | Transforming two-way alternating finite automata to one-way nondeterministic automata | |
TWI806340B (en) | Test circuit for pipeline stage including sequential device to be tested, test method and computing system including test circuit | |
US20140237013A1 (en) | Pseudo-random bit sequence generator | |
JP2016126517A (en) | Device and method for generating random numbers | |
WO2014041783A1 (en) | Circuit for detecting character string and method for detecting character string | |
JP6379032B2 (en) | Random number generation device and random number generation method | |
CN101187692B (en) | Semiconductor integrated circuit | |
KR101276796B1 (en) | Apparatus and method for matching pattern | |
CN110213037B (en) | Stream cipher encryption method and system suitable for hardware environment | |
Klimushyn et al. | Crypto-resistant methods and random number generators in internet of things (iot) devices | |
JP5298823B2 (en) | Alarm processing circuit and alarm processing method | |
JP7377393B2 (en) | true random number generator | |
Bhateja | A TGV-like approach for asynchronous testing | |
JP5960639B2 (en) | Information processing apparatus and information processing method | |
US9002861B2 (en) | Matching device and computer-readable storage medium | |
JP2018142816A (en) | PUF (Physically Unclonable Function) code generation device and PUF code authentication system | |
Yun et al. | Regular expression pattern matching supporting constrained repetitions | |
JP6629640B2 (en) | Command control device, command control method, and command control program | |
Adak | Cellular automaton as generator of primitive polynomials in gf (2) |